This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/13942] New: x86 acos inaccurate near 1


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

             Bug #: 13942
           Summary: x86 acos inaccurate near 1
           Product: glibc
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jsm28@gcc.gnu.org
    Classification: Unclassified


http://sourceware.org/ml/libc-help/2008-09/msg00031.html (mentioned in a recent
bug) reports an issue with acos on x86 being inaccurate near 1 because of using
sqrt (1 - x*x).  This is still present with current sources, as illustrated by
the test:

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

volatile double d = 0x0.ffffffff8p0;

int
main (void)
{
  volatile double r = acos (d);
  printf ("%.14a\n", r);
  return 0;
}

This prints 0x1.000000002aaab0p-16 when an accurate result computed by GNU MPFR
is 0x1.000000000aaab0p-16.

It looks like this issue will affect x86 acos and acosl and x86_64 acosl.  For
acosf the squaring (in x87 64-bit precision) will always be exact so there is
no problem.  For asin functions and for acos functions near -1 I don't think
there will be significant loss of accuracy from this issue (the result will be
near pi/2 or pi and the problem is for results near 0) but probably all the
functions (other than asinf/acosf) should be fixed and tests added to the
testsuite for all these cases.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]