mpz_get_d() with rounding
Torbjörn Granlund
tg at gmplib.org
Thu May 22 09:30:07 UTC 2014
Jeroen Demeyer <jdemeyer at cage.ugent.be> writes:
The function mpz_get_d() rounds towards zero. This is incompatible
with the usual floating-point semantics of rounding to nearest. In C
on my machine for example, a conversion from unsigned long to double
rounds to nearest. Would you agree with adding additional functions
(or one function with an MPFR-style rounding flag) for other rounding
modes?
I am not sure this would be very useful. Such a function would only
work slightly different for integers t such that 2^53 < |t| <= 2^1023.
ALso, I expect this to be tricky to implement in a portable and correct
way.
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-discuss
mailing list