public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/13524] New: glibc 32: sscanf get wrong result for long double at 4e-28 and 8e-28 at Linux on Power
@ 2011-12-21 2:58 guojiufu at gmail dot com
2011-12-21 23:03 ` [Bug libc/13524] " schwab@linux-m68k.org
2014-06-27 11:27 ` fweimer at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: guojiufu at gmail dot com @ 2011-12-21 2:58 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=13524
Bug #: 13524
Summary: glibc 32: sscanf get wrong result for long double at
4e-28 and 8e-28 at Linux on Power
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper.fsp@gmail.com
ReportedBy: guojiufu@gmail.com
Classification: Unclassified
Hardware >POWER5+
software
---
#include<stdio.h>
#include<math.h>
union U { long double ld; int d[sizeof(long double)/sizeof(int)];};
void Print(long double data) {
union U u;
u.ld=data;
printf("long double:%Lg\t hex:" ,u.ld);
int i;
for(i = 0; i < sizeof(long double)/sizeof(int);++i) printf("%0x ",u.d[i]);
printf("\n");
}
void foo(char * str,long double b){
long double a ;
(void)sscanf(str, "%Le", &a);
Print(b);
Print(a);
Print(a-b);
}
int main()
{
foo("4e-28L",+4e-28L);
foo("8e-28L",+8e-28L);
return 0 ;
}
-----------
gcc t.c -m32;./a.out
long double:4e-28 hex:3a3fb0f6 be506019 36d06c5e 54eb70c4
long double:4e-28 hex:3a3fb0f6 be506019 36d06c5e 54eb70e4
long double:7.96546e-59 hex:33e00000 0 0 0
long double:8e-28 hex:3a4fb0f6 be506019 36e06c5e 54eb70c4
long double:8e-28 hex:3a4fb0f6 be506019 36e06c5e 54eb70d4
long double:7.96546e-59 hex:33e00000 0 0 0
--
gcc t.c -m64;./a.out
long double:4e-28 hex:3a3fb0f6 be506019 36d06c5e 54eb70c4
long double:4e-28 hex:3a3fb0f6 be506019 36d06c5e 54eb70c4
long double:0 hex:0 0 0 0
long double:8e-28 hex:3a4fb0f6 be506019 36e06c5e 54eb70c4
long double:8e-28 hex:3a4fb0f6 be506019 36e06c5e 54eb70c4
long double:0 hex:0 0 0 0
--
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-27 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 2:58 [Bug libc/13524] New: glibc 32: sscanf get wrong result for long double at 4e-28 and 8e-28 at Linux on Power guojiufu at gmail dot com
2011-12-21 23:03 ` [Bug libc/13524] " schwab@linux-m68k.org
2014-06-27 11:27 ` fweimer at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).