[PPL-devel] Handling of floating point numbers changed from GMP 4.1.4 to GMP 4.2.1

Roberto Bagnara bagnara at cs.unipr.it
Thu Sep 13 15:03:35 CEST 2007


Paul Zimmermann wrote:
> I tried your program on a Pentium 4, under Linux, with gmp-4.1.4,
> gmp-4.2.1, and gmp-4.2.2, for all 4 rounding modes, compiled like this:
> 
> mermoz% g++ -I/users/spaces/logiciels/gmp-4.1.4/p4/include bagnara.c /users/spaces/logiciels/gmp-4.1.4/p4/lib/libgmpxx.a /users/spaces/logiciels/gmp-4.1.4/p4/lib/libgmp.a -lm
> 
> I get 121.83249999999999602 in all cases, except with gmp-4.1.4 and FE_UPWARD,
> where I get 121.83250000000001023, which is wrong, since it is larger than
> 137171200400403985/1125899906842624, whereas the documentation says that
> mpq_get_d rounds towards zero.
> 
> Thus I confirm there was a problem in 4.1.4, and it is now fixed, i.e.,
> mpq_get_d does not depend any more on the processor rounding mode, and
> returns the correct result (at least for that example, and on my machine).

Thanks everyone!  We will now see how best get around the problem
(I don't know why, but most Linux distributions are still at GMP 4.1.4).

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list