[Bug c/45205] New: printf does not print some long doubles correctly

2010-08-05 Thread kmmertes at gmail dot com
The following code should print "18014398509481983.0"  but it prints
"36028797018963967.0" instead .

long double a = 18014398509481984.0;
long double b = -1.0;
long double c = a + b;

printf("%.1Lf\n", c);

I used "gcc -v -save-temps -Wall main.c"


-- 
   Summary: printf does not print some long doubles correctly
   Product: gcc
   Version: 4.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kmmertes at gmail dot com
 GCC build triplet: powerpc-apple-darwin8
  GCC host triplet: powerpc-apple-darwin8
GCC target triplet: powerpc-apple-darwin8


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



[Bug c/45205] printf does not print some long doubles correctly

2010-08-05 Thread kmmertes at gmail dot com


--- Comment #1 from kmmertes at gmail dot com  2010-08-06 00:41 ---
Created an attachment (id=21418)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21418&action=view)
short program that demonstrates the problem and possible cause


-- 


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



[Bug c/45205] printf does not print some long doubles correctly

2010-08-05 Thread kmmertes at gmail dot com


--- Comment #2 from kmmertes at gmail dot com  2010-08-06 00:44 ---
Created an attachment (id=21419)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21419&action=view)
preprocessed file for main.c


-- 


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



[Bug target/45205] printf does not print some long doubles correctly

2010-08-05 Thread kmmertes at gmail dot com


--- Comment #4 from kmmertes at gmail dot com  2010-08-06 03:15 ---
Sorry I forgot to include output of gcc -v:
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5367.obj~1/src/configure
--disable-checking -enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.0/
--with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib
--build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8
--target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5367)


-- 


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



[Bug target/45205] printf does not print some long doubles correctly

2010-08-05 Thread kmmertes at gmail dot com


--- Comment #6 from kmmertes at gmail dot com  2010-08-06 04:17 ---
Can you compile and run the program on a PowerPC computer with a version of gcc
that you do support to see if the problem persists?  Here is the output from my
system:

   a ->  18014398509481984.0 :  43 50 00 00 00 00 00 00 00 00 00 00 00 00
00 00
 + b -> -1.0 :  bf f0 00 00 00 00 00 00 00 00 00 00 00 00
00 00
 = c ->  36028797018963967.0 :  43 50 00 00 00 00 00 00 bf f0 00 00 00 00
00 00


-- 


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



[Bug target/45205] printf does not print some long doubles correctly

2010-08-05 Thread kmmertes at gmail dot com


--- Comment #7 from kmmertes at gmail dot com  2010-08-06 04:21 ---
Prettier version of output (I hope):

 a ->  18014398509481984.0 : 43 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b -> -1.0 : bf f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=c ->  36028797018963967.0 : 43 50 00 00 00 00 00 00 bf f0 00 00 00 00 00 00


-- 


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