From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10761 invoked by alias); 21 Dec 2011 02:58:17 -0000 Received: (qmail 10582 invoked by uid 22791); 21 Dec 2011 02:58:16 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Dec 2011 02:58:03 +0000 From: "guojiufu at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: guojiufu at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: drepper.fsp at gmail dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00051.txt.bz2 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 #include 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.