From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19308 invoked by alias); 15 Aug 2012 15:10:08 -0000 Received: (qmail 19233 invoked by uid 22791); 15 Aug 2012 15:10:04 -0000 X-SWARE-Spam-Status: No, hits=-3.0 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, 15 Aug 2012 15:09:50 +0000 From: "liubov.dmitrieva at gmail dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug math/14473] New: Inaccurate CPOWF function on x86_32 and x86_64 Date: Wed, 15 Aug 2012 15:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: math X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: liubov.dmitrieva at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org 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: 2012-08/txt/msg00082.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14473 Bug #: 14473 Summary: Inaccurate CPOWF function on x86_32 and x86_64 Product: glibc Version: 2.17 Status: NEW Severity: normal Priority: P2 Component: math AssignedTo: unassigned@sourceware.org ReportedBy: liubov.dmitrieva@gmail.com Classification: Unclassified // gcc main.c -std=c99 -lm <-m32> #include #include #include #include #include // abs function for int argument #define ireal(a) (((int*)&(a))[0]) #define iimag(a) (((int*)&(a))[1]) #define real(a) (((float*)&(a))[0]) #define imag(a) (((float*)&(a))[1]) int main() { float _Complex a,b,r1,r2; ireal(a)=0xbf0e38e4; iimag(a)=0xbde38e3e; //argument ireal(b)=0x3f0e38e3; iimag(b)=0xbde38e3e; //argument fesetround(FE_TONEAREST); r1 = cpowf(a,b); //actual result r2 = cpow(a,b); //actual result 2 printf("inputs: a.real = (0x%08x)\t%e\n", ireal(a), real(a)); printf(" a.imag = (0x%08x)\t%e\n", iimag(a), imag(a)); printf("\n"); printf("inputs: b.real = (0x%08x)\t%e\n", ireal(b), real(b)); printf(" b.imag = (0x%08x)\t%e\n", iimag(b), imag(b)); printf("\n"); printf("actual.real = (0x%08x)\t%.13e\n", ireal(r1), real(r1)); printf("expected.real = (0x%08x)\t%.13e\n", ireal(r2), real(r2)); printf("error.real = %d ulp\n", abs(ireal(r1) - ireal(r2))); printf("\n"); printf("actual.imag = (0x%08x)\t%.13e\n", iimag(r1), imag(r1)); printf("expected.imag = (0x%08x)\t%.13e\n", iimag(r2), imag(r2)); printf("error.imag = %d ulp\n", abs(iimag(r1) - iimag(r2))); return 0; } Result x86_32 (core2): inputs: a.real = (0xbf0e38e4) -5.555556e-01 a.imag = (0xbde38e3e) -1.111111e-01 inputs: b.real = (0x3f0e38e3) 5.555555e-01 b.imag = (0xbde38e3e) -1.111111e-01 actual.real = (0xba6f8923) -9.1375614283606e-04 expected.real = (0xba6f8d77) -9.1382063692436e-04 error.real = 1108 ulp actual.imag = (0xbf069c6d) -5.2582436800003e-01 expected.imag = (0xbf069c6d) -5.2582436800003e-01 error.imag = 0 ulp Result x86_64 (core2): inputs: a.real = (0xbf0e38e4) -5.555556e-01 a.imag = (0xbde38e3e) -1.111111e-01 inputs: b.real = (0x3f0e38e3) 5.555555e-01 b.imag = (0xbde38e3e) -1.111111e-01 actual.real = (0xba6f8923) -9.1375614283606e-04 expected.real = (0xba6f8d77) -9.1382063692436e-04 error.real = 1108 ulp actual.imag = (0xbf069c6d) -5.2582436800003e-01 expected.imag = (0xbf069c6d) -5.2582436800003e-01 error.imag = 0 ulp -- 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.