I use the sqrt () function from the math library when I build for 64bit using -m64. I get the correct result, but when I build for 32-bit, I have very inconsistent behavior.
For example, on a 64-bit page
double dx = 0x1.fffffffffffffp+1023; sqrt(dx);
(which, I believe, is a properly rounded result tested with mpfr)
But on a 32-bit input value, it behaves differently.
double dx = 0x1.fffffffffffffp+1023; sqrt(dx);
When the same value is passed to a variable, I get the wrong result. I checked the rounding mode before and after each call, and they are all set to round to the nearest. What reason? I use gcc 4.6 on a 64-bit machine, and the -mfpmath=sse
and -march=pentium
options for both x86 nad x64 cases.
kanna source share