C floating point & fsetround(FE_DOWNWARD) question
Jon Grimm
jgrimm2@us.ibm.com
Tue Apr 5 19:08:00 GMT 2005
Hi there. Executing the following program compiled with ppc64-unknown-linux gcc::
include <stdio.h>
#include <fenv.h>
int main()
{
int x=1023, y=1023;
double z;
fesetround(FE_DOWNWARD);
z = (double)(x-y);
printf ("z = %e\n", z);
return 0;
}
If I compile this as 32-bit (-m32) I get a result of:
z = -0.000000e+00
But compiling for 64-bit (-m64):
z = 0.000000e+00
I'm trying to figure out whether one of these is incorrect, or either result is fine with regards to C99 or other relevant standards' expectations?
Thanks,
Jon
More information about the Gcc-help
mailing list