C floating point & fsetround(FE_DOWNWARD) question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux