mpz_get_d_2exp

Damien Stehle stehle at maths.usyd.edu.au
Wed Feb 1 23:12:02 CET 2006


Hello,

I guess I found a bug in the documentation of the function
double mpz_get_d_2exp (signed long int *EXP, mpz_t OP).

The doc says:
 - Function: double mpz_get_d_2exp (signed long int *EXP, mpz_t OP)
     Find D and EXP such that D times 2 raised to EXP, with
     0.5<=abs(D)<1, is a good approximation to OP.
This is not corresponding to what happens for OP=0.

They had approximately the same bug in MPFR, and they corrected it 
by something like:
 
Return D and set EXP such that 0.5<=|D|<1
and D times 2 raised to EXP is a good approximation to OP.
If OP is zero, then D=EXP=0.

Regards,
Damien Stehle


More information about the gmp-bugs mailing list