public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "guojiufu at gmail dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/13524] New: glibc 32: sscanf get wrong result for long double at 4e-28 and 8e-28 at Linux on Power Date: Wed, 21 Dec 2011 02:58:00 -0000 [thread overview] Message-ID: <bug-13524-131@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2011-12-21 2:58 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-12-21 2:58 guojiufu at gmail dot com [this message] 2011-12-21 23:03 ` [Bug libc/13524] " schwab@linux-m68k.org 2014-06-27 11:27 ` fweimer at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-13524-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).