This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Update sparc ULPs.
Ok I adjusted my patch with your feedback in mind. See at the
end of this email.
But I had some trouble in my crash course of trying to use MPFR
to generate test cases. For example I tried to use:
--------------------
#include <stdio.h>
#include <mpfr.h>
int main(void)
{
char str[64];
mpfr_t x, y;
int i;
mpfr_init2 (x, 300);
mpfr_init2 (y, 300);
for (i = 10; i < 120; i+= 10) {
sprintf(str, "1e-%d", i);
mpfr_set_str (x, str, 10, MPFR_RNDN);
mpfr_y0 (y, x, MPFR_RNDN);
mpfr_printf ("y0(%d): %Ra\n", i, y);
}
return 0;
}
--------------------
Which, for example, generates:
y0(10): -0xe.bb862fbb05c0be5781f1ba338863546295571dbc980dae4ae815d43997f6c76ca47758debp+0
Which I transformed into testcase:
====================
TEST_f_f (y0, 0x1p-10, -0xe.bb862fbb05c0be5781f1ba338863546295571dbc980dae4ae815d43997f6c76ca47758debp+0);
====================
but that doesn't seem to be right:
====================
testing float (without inline functions)
Failure: Test: y0 (0x1p-10) == -0xe.bb862fbb05c0be5781f1ba338863546295571dbc980dae4ae815d43997f6c76ca47758debp+0
Result:
is: -4.48651504516601562500e+00 -0x1.1f231000000000000000p+2
should be: -1.47325162887573242188e+01 -0x1.d770c600000000000000p+3
difference: 1.02460012435913085938e+01 0x1.47df3e00000000000000p+3
ulp : 10743711.0000
max.ulp : 0.0000
Maximal error of `y0'
is : 10743711 ulp
accepted: 1 ulp
====================
It's obvious I've never done this before :-)
diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c
index 0729cd0..8a8801d 100644
--- a/sysdeps/ieee754/flt-32/e_j0f.c
+++ b/sysdeps/ieee754/flt-32/e_j0f.c
@@ -138,7 +138,7 @@ __ieee754_y0f(float x)
}
return z;
}
- if(ix<=0x32000000) { /* x < 2**-27 */
+ if(ix<=0x36800000) { /* x < 2**-18 */
return(u00 + tpi*__ieee754_logf(x));
}
z = x*x;
diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c
index 30b7d8e..7c2b649 100644
--- a/sysdeps/ieee754/flt-32/e_j1f.c
+++ b/sysdeps/ieee754/flt-32/e_j1f.c
@@ -67,7 +67,7 @@ __ieee754_j1f(float x)
if(hx<0) return -z;
else return z;
}
- if(__builtin_expect(ix<0x32000000, 0)) { /* |x|<2**-27 */
+ if(__builtin_expect(ix<0x36800000, 0)) { /* |x|<2**-18 */
if(huge+x>one) return (float)0.5*x;/* inexact if x!=0 necessary */
}
z = x*x;
diff --git a/sysdeps/ieee754/ldbl-128/e_j0l.c b/sysdeps/ieee754/ldbl-128/e_j0l.c
index 112a8f3..fb98ea7 100644
--- a/sysdeps/ieee754/ldbl-128/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j0l.c
@@ -831,6 +831,8 @@ long double
return -HUGE_VALL + x;
}
xx = fabsl (x);
+ if (xx <= 0x1p-57)
+ return TWOOPI * __ieee754_logl (x);
if (xx <= 2.0L)
{
/* 0 <= x <= 2 */
diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c
index 1f62bd0..f16343b 100644
--- a/sysdeps/ieee754/ldbl-128/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j1l.c
@@ -838,6 +838,8 @@ __ieee754_y1l (long double x)
return -HUGE_VALL + x;
}
xx = fabsl (x);
+ if (xx <= 0x1p-114)
+ return -TWOOPI / x;
if (xx <= 2.0L)
{
/* 0 <= x <= 2 */