public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/1161] New: powf inaccurate for some inputs
@ 2005-08-03 17:31 bob dot wilson at acm dot org
  2005-10-15 23:47 ` [Bug math/1161] " drepper at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bob dot wilson at acm dot org @ 2005-08-03 17:31 UTC (permalink / raw)
  To: glibc-bugs

The version of powf() in sysdeps/ieee754/flt-32/e_powf.c gives results that are wrong by more than 1 
ulp for at least some inputs.  The testcase below will demonstrate the problem for powf(-1.100000e
+00, 1.010000e+02).  The output from this test on an x86_64 platform running RH Enterprise 3 is:

inputs: a = -1.100000e+00 b = 1.010000e+02
actual    =     -1.5158703e+04  (0xc66cdad0)
expected  =     -1.5158707e+04  (0xc66cdad4)
pow(a, b) =     -1.5158706757936e+04

The actual value is off by 4 ulp from the expected value, so the absolute error must be at least 3 ulp.  
Other math libraries derived from fdlibm (e.g., newlib) have the same problem.  The test program is:

#include <stdio.h>
#include <math.h>

unsigned int ta = 0xBF8CCCCD;
unsigned int tb = 0x42CA0000;

main ()
{
  float a = *(float *)&ta;
  float b = *(float *)&tb;
  float c = powf(a, b);
  float d = pow(a, b);
  printf("inputs: a = %e b = %e\n", a, b);
  printf("actual    =\t%.7e\t(0x%08x)\n", c, *(unsigned *)&c);
  printf("expected  =\t%.7e\t(0x%08x)\n", d, *(unsigned *)&d);
  printf("pow(a, b) =\t%.13e\n", pow(a, b));
}

-- 
           Summary: powf inaccurate for some inputs
           Product: glibc
           Version: 2.3.2
            Status: NEW
          Severity: minor
          Priority: P3
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: bob dot wilson at acm dot org
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: x86_64-redhat-linux


http://sources.redhat.com/bugzilla/show_bug.cgi?id=1161

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug math/1161] powf inaccurate for some inputs
  2005-08-03 17:31 [Bug math/1161] New: powf inaccurate for some inputs bob dot wilson at acm dot org
@ 2005-10-15 23:47 ` drepper at redhat dot com
  2009-09-24  8:03 ` vincent+libc at vinc17 dot org
  2009-09-24  8:12 ` vincent+libc at vinc17 dot org
  2 siblings, 0 replies; 4+ messages in thread
From: drepper at redhat dot com @ 2005-10-15 23:47 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2005-10-15 23:47 -------
Once somebody provides a better implementation we can use it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |drepper at redhat dot com
             Status|NEW                         |SUSPENDED


http://sourceware.org/bugzilla/show_bug.cgi?id=1161

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug math/1161] powf inaccurate for some inputs
  2005-08-03 17:31 [Bug math/1161] New: powf inaccurate for some inputs bob dot wilson at acm dot org
  2005-10-15 23:47 ` [Bug math/1161] " drepper at redhat dot com
@ 2009-09-24  8:03 ` vincent+libc at vinc17 dot org
  2009-09-24  8:12 ` vincent+libc at vinc17 dot org
  2 siblings, 0 replies; 4+ messages in thread
From: vincent+libc at vinc17 dot org @ 2009-09-24  8:03 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From vincent+libc at vinc17 dot org  2009-09-24 08:03 -------
FYI, this is similar to bug 706 (on pow() inaccuracies, which are particularly
visible for x ~ 1.0).

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=1161

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug math/1161] powf inaccurate for some inputs
  2005-08-03 17:31 [Bug math/1161] New: powf inaccurate for some inputs bob dot wilson at acm dot org
  2005-10-15 23:47 ` [Bug math/1161] " drepper at redhat dot com
  2009-09-24  8:03 ` vincent+libc at vinc17 dot org
@ 2009-09-24  8:12 ` vincent+libc at vinc17 dot org
  2 siblings, 0 replies; 4+ messages in thread
From: vincent+libc at vinc17 dot org @ 2009-09-24  8:12 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From vincent+libc at vinc17 dot org  2009-09-24 08:12 -------
*** Bug 3407 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |myles at peakstreaminc dot
                   |                            |com


http://sourceware.org/bugzilla/show_bug.cgi?id=1161

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-24  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-03 17:31 [Bug math/1161] New: powf inaccurate for some inputs bob dot wilson at acm dot org
2005-10-15 23:47 ` [Bug math/1161] " drepper at redhat dot com
2009-09-24  8:03 ` vincent+libc at vinc17 dot org
2009-09-24  8:12 ` vincent+libc at vinc17 dot org

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).