This is the mail archive of the
mailing list for the GCC project.
Re: Kahan's Floating Point Test
On Wed, May 30, 2001 at 12:51:22PM -0400, Stephen L Moshier wrote:
> The floating point hardware on x86 is not IEEE compliant. You can
> come close by setting the rounding precision of the fpu to the desired
> working precision of the numbers. See /usr/include/fpu_control.h
> on linux for the functions or macros to do that.
What I don't understand is why the results were different on two x86
machines. Setting the rounding precision to double rather than extended
helped every test except for one where the result was way off.
X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065218e+00 as X -> 1
calculated 7.38905609548934539e+00 until I switched to double rounding
precision when it went to 5.45981484040809093e+01
One 5th degree polynomial curve fit on some data produces different solution
vectors on a Linux and FreeBSD machine, both of which are on x86 hardware.
No combination of gcc command line options or rounding precision produces
answers that are similar to more than a few decimal places.
And this is expected to happen when you compile the same program with the
same compiler on x86 hardware? The only difference is Pentium III versus AMD
Thunderbird and different libc's (glibc versus FreeBSD libc).
Distributed Processing Lab; Lockheed Martin Adv. Tech. Labs
A&E 3W; 1 Federal Street; Camden, NJ 08102
856-338-4021, fax 856-338-4144 email: email@example.com