[PPL-devel] [Fwd: Re: 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:01:37 CEST 2007



-------- Original Message --------
Subject: Re: Handling of floating point numbers changed from GMP 4.1.4 to GMP 4.2.1
Date: Thu, 13 Sep 2007 14:42:12 +0200
From: Paul Zimmermann <Paul.Zimmermann at loria.fr>
To: Roberto Bagnara <bagnara at cs.unipr.it>
CC: Vincent.Lefevre at ens-lyon.fr, tg at swox.com

        Roberto,

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).

Paul


-- 
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