[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
Wed Sep 12 17:07:13 CEST 2007



-------- Original Message --------
Subject: Re: Handling of floating point numbers changed from GMP 4.1.4 to	GMP 4.2.1
Date: Wed, 12 Sep 2007 16:55:04 +0200
From: Vincent Lefevre <vincent at vinc17.org>
To: gmp-discuss at swox.com
References: <46E7A688.3030305 at cs.unipr.it>

On 2007-09-12 10:42:48 +0200, Roberto Bagnara wrote:
> The results are different depending on whether it is linked to GMP 4.1.4
> or with GMP 4.2.1.  For example, on my Fedora 7, x86_64 machine where I
> have GMP 4.1.4 in /usr/lib64 and GMP 4.2.1 in /usr/local/lib, I use the
> script
> 
> g++ -I/usr/local/include -o bug.o -c bug.cc
> g++ -static -o bug-gmp-4.2.1 bug.o -L/usr/local/lib -lm -lgmpxx -lgmp
> g++ -static -o bug-gmp-4.1.4 bug.o -L/usr/lib64 -lm -lgmpxx -lgmp
> ./bug-gmp-4.2.1
> ./bug-gmp-4.1.4
> 
> This prints
> 
> real_coeff = 137171200400403985/1125899906842624
> float = 121.83249999999999602
> real_coeff = 137171200400403985/1125899906842624
> float = 121.83250000000001023
> 
> The mismatch does not happen if one does not touch the rounding mode
> or if one sets it to FE_TONEAREST, FE_TOWARDZERO, FE_DOWNWARD.
> So, on this example, while GMP 4.1.4 results do not depend on the
> rounding mode, with GMP 4.2.1 the rounding mode matters.

Were they compiled with the same compiler and the same compile switches?
If not, perhaps one uses SSE2 while the other one uses the traditional
FPU.

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
_______________________________________________
gmp-discuss mailing list
gmp-discuss at swox.com
http://swox.com/mailman/listinfo/gmp-discuss


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