Bug 16492 - large error in y0, y0l and y0f128
Summary: large error in y0, y0l and y0f128
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-22 08:34 UTC by Paul Zimmermann
Modified: 2021-04-02 04:45 UTC (History)
1 user (show)

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 Paul Zimmermann 2014-01-22 08:34:44 UTC
with the test program below I get on a x86_64 processor:

GNU libc version: 2.18.90
GNU libc release: development
x=8.9357301493606989e-01
libc: y0(x)=-3.4749010007703585e-06
mpfr: y0(x)=-3.4749010007607514e-06
ulp difference: -22684.000000

I will keep track of such errors on http://www.loria.fr/~zimmerma/glibc/.

Paul Zimmermann

#include <stdio.h>
#include <math.h>
#include <mpfr.h>
#include <gnu/libc-version.h>

double
ulp (double x, double y)
{
  double z = x - y;
  int ey;
  y = frexp (y, &ey);
  y = ldexp (1.0, ey - 53);
  return z / y;
}

int
main ()
{
  double x = 8.9357301493606989e-1;
  double y, z;
  mpfr_t t;

  printf("GNU libc version: %s\n", gnu_get_libc_version ());
  printf("GNU libc release: %s\n", gnu_get_libc_release ());
  y = y0 (x);
  mpfr_init2 (t, 53);
  mpfr_set_d (t, x, MPFR_RNDN);
  mpfr_y0 (t, t, MPFR_RNDN);
  z = mpfr_get_d (t, MPFR_RNDN);
  printf ("x=%.16e\n", x);
  printf ("libc: y0(x)=%.16e\n", y); /* -3.4749010007703585e-06 */
  printf ("mpfr: y0(x)=%.16e\n", z); /* -3.4749010007607514e-06 */
  printf ("ulp difference: %f\n", ulp (y, z)); /* -22684.000000 */
  return 0;
}
Comment 1 Paul Zimmermann 2021-03-31 05:45:39 UTC
cf https://members.loria.fr/PZimmermann/papers/accuracy.pdf for largest known errors found so far. Here are the inputs of the version from February 5, 2021, corresponding to GNU libc 2.33.

dbl-64:
y0 0x1.c982eb8d417eap-1 (5.93e15 ulps)

ldbl-96:
y0 0xe.4c175c6a0bf51e8p-4l (1.38e18 ulps)

float128:
y0 0x6.b99c822052e965e1754eb5ffeb08p+4 (1.69e33 ulps)
Comment 2 Paul Zimmermann 2021-04-02 04:45:22 UTC
The commit that reduces the errors in the binary32 format is 9acda61
(April 1st, 2021). See also #27670 for the other Bessel functions (j0, j1, y1).