Re: regression in tgamma?

Jeff Johnston via Newlib <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAOox84srOEu0YS0WPv8CfVzfKFqQ3M3Z=RXtbQXomwj4qyjxWQ@mail.gmail.com>
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 <[email protected]>
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
>
>
>
>
>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.