[Bug c/42184] Same literal behaves differently as a double than as a long double

kargl at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Nov 26 17:13:00 GMT 2009



------- Comment #1 from kargl at gcc dot gnu dot org  2009-11-26 17:13 -------
I think that you may be looking at a library issue
and the conversion of a decimal string to binary.

Add
    printf("%La\n%La\n%La\n%La\n", value1, value2, value3, value4);

to your program yields
REMOVE:kargl[209] ./z
0x1.68f5c2c528fa3p+70
0x1.68f5c2c528fa3p+70
0x1.68f5c2c528fa3p+70
0x1.68f5c2c528fa36p+70
1 1 1 0

on FreeBSD.  If I replace 1.6646342e21 everywhere in your program
with 0x1.68f5c2c528fa3p+70, I get the result you expect, ie.,

REMOVE:kargl[212] ./z
0x1.68f5c2c528fa3p+70
0x1.68f5c2c528fa3p+70
0x1.68f5c2c528fa3p+70
0x1.68f5c2c528fa3p+70
1 1 1 1


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42184



More information about the Gcc-bugs mailing list