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/15734] New: IBM long double erfl and erfcl very inaccurate


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

            Bug ID: 15734
           Summary: IBM long double erfl and erfcl very inaccurate
           Product: glibc
           Version: 2.18
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: amodra at gmail dot com

The IBM long double implementation of erfl() and erfcl() both give inaccurate
results when given a negative argument such that the component doubles have
differing sign.  Also, erfl() with a large negative argument returns +1.0
rather than -1.0.

The following compiled with -O0 shows one such bad result.  (Compare with
results from -O2 where gcc evalates erfl and erfl.)

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

int
main (void)
{
  long double x, z;
  union { long double ld; double d[2]; } u;

  x = -0x1.fffffffffffff8p-2L;
  z = erfl (x);

  u.ld = x;
  printf ("%24.21Lf %36La %21a %21a\n", u.ld, u.ld, u.d[0], u.d[1]);
  u.ld = z;
  printf ("%24.21Lf %36La %21a %21a\n", u.ld, u.ld, u.d[0], u.d[1]);

  z = erfcl (x);
  u.ld = z;
  printf ("%24.21Lf %36La %21a %21a\n", u.ld, u.ld, u.d[0], u.d[1]);

  return 0;
}

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