I would like to announce MPFR_wrap.jl, a set of wrappers around MPFR, a multiple-precision floating-point library for in-place computation.
MPFR_wrap.jl does not introduce new types and makes instead use of Julia’s
Most operations defined in Base on
BigFloats however allocate temporary variables. Consider the computation of
sqrt(a+b): a new
BigFloat is allocated to hold the result of
MPFR_wrap, one can do
add!(a, a, b) # a ← a + b sqrt!(a, a) # a ← sqrt(a)
provided the content of
a can be overwritten.
The package is not registered yet: if you want to give it a try, at the package prompt ("]"), type
(@v1.4) pkg> add https://github.com/mzaffalon/MPFR_wrap.jl
This is my first public module: feedback is welcome.
This module was born out of curiosity to implement the computation of pi using iterative methods as explained in this review by David H. Bailey and to compare with the timings of table 3.
The in-place computation of pi to 100_000 digits takes 130ms on my laptop, compared to 350ms using the operations defined in Base; a substantial difference between the two methods can be seen when one consider allocations: 400 kB compared to 12 MB.
Disclaimer: I am not an expert in the computation of pi.