regression in tgamma?

Jeff Johnston jjohnstn@redhat.com
Wed Dec 16 20:31:47 GMT 2020


Hi Paul,

I believe I found the problem.

The __ieee754_tgamma functions are not declared in fdlibm.h so the calls in
tgamma and tgammaf are using
default parms and getting things wrong.  My test calling __ieee754_tgamma
directly only worked after I added
a declaration to __ieee754_tgamma locally.

I have pushed a change to master.  Please try it out.

-- Jeff J.


On Wed, Dec 16, 2020 at 8:49 AM Paul Zimmermann <Paul.Zimmermann@inria.fr>
wrote:

>        Hi,
>
> the regression I observed also concerns the binary32 code.
> Consider the following code:
>
> $ cat /tmp/test_tgamma.c
> #include <stdio.h>
> #include <math.h>
>
> #ifdef NEWLIB
> int errno;
> int* __errno () { return &errno; }
> #endif
>
> int main()
> {
>   float x = -0.0f;
>   float y = tgammaf (x);
>   printf ("x=%a y=%a\n", x, y);
>   {
>     double x = -0x1.53f198fe3b278p+7, y;
>     y = tgamma (x);
>     printf ("x=%a y=%a\n", x, y);
>   }
> }
>
> With commit a0d7982ff486292540078c0121a435013c5ee1ea it gives on
> x86_64/linux
> (Intel(R) Core(TM) i5-4590):
>
> $ gcc -no-pie -DNEWLIB /tmp/test_tgamma.c
> build/x86_64/newlib/libm/tmp/libm.a
> $ ./a.out
> x=-0x0p+0 y=inf
> x=-0x1.53f198fe3b278p+7 y=0x1.fd6d312572d9cp-1015
>
> and with commit 1f8e5847dff27e504949cd21bfeadb987d36ad19:
>
> $ gcc -no-pie -DNEWLIB /tmp/test_tgamma.c
> build/x86_64/newlib/libm/tmp/libm.a
> $ ./a.out
> x=-0x0p+0 y=0x1p+0
> x=-0x1.53f198fe3b278p+7 y=0x1p+0
>
> Paul
>
>
>
>
>
>
>
>


More information about the Newlib mailing list