This is the mail archive of the libc-alpha@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]

Re: [PATCH] Update sparc ULPs.


On Sat, 17 Nov 2012, David Miller wrote:

> 		sprintf(str, "1e-%d", i);

You mean "0x1p-%d", to get values that are exactly representable for all 
floating-point formats.

> 		mpfr_set_str (x, str, 10, MPFR_RNDN);

And use 0 instead of 10 here.

> ====================
>   TEST_f_f (y0, 0x1p-10, -0xe.bb862fbb05c0be5781f1ba338863546295571dbc980dae4ae815d43997f6c76ca47758debp+0);

And use a "L" suffix on the expected result to avoid it getting truncated 
to "double" precision.  (Tests generally use 35-40 decimal places in 
expected results, except for functions such as fma that really do expect a 
precise result for each format, where hex float results are used.)

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

The analogue of the double 2**-27 would be 2**-13.

> 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 */

The analogue of the double 2**-54 would be 2**-25.

> 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);

Still missing the addition of (2/pi)*(log(1/2)+gamma) = -0.073804... 
(which of course can be calculated sufficiently precisely with MPFR).

-- 
Joseph S. Myers
joseph@codesourcery.com


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