Bug 15734 - IBM long double erfl and erfcl very inaccurate
Summary: IBM long double erfl and erfcl very inaccurate
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: 2.19
Assignee: Alan Modra
URL: http://sourceware.org/ml/libc-alpha/2...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-12 14:44 UTC by Alan Modra
Modified: 2014-06-13 09:25 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Modra 2013-07-12 14:44:41 UTC
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;
}
Comment 1 Alan Modra 2013-10-05 03:00:39 UTC
Fixed