public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
To: Jeff Johnston <jjohnstn@redhat.com>
Cc: keithp@keithp.com, newlib@sourceware.org
Subject: Re: regression in tgamma?
Date: Fri, 18 Dec 2020 07:36:40 +0100	[thread overview]
Message-ID: <mwsg8339jb.fsf@tomate.loria.fr> (raw)
In-Reply-To: <CAOox84uKYDq7huWPwFFz7jZpJpUR1dJdfQipv-tr1RU6YzxESg@mail.gmail.com> (message from Jeff Johnston on Thu, 17 Dec 2020 16:28:12 -0500)

       Hi Jeff,

> I have modified er_lgamma.c, erf_lgamma.c, w_tgamma.c, wf_tgamma.c based on
> code changes in picolibc.
> I did not add the new ___ieee754_ sub-functions and instead modified the
> existing code assuming that the function
> was called with *signgam = 0.  We can always do a merge from picolibc in the
> future.
> 
> With the new code, the test runs as expected.
> 
> Paul, please confirm before tomorrow.

version b2f3d59 fails to compile on my x86_64 machine:

../../../../../newlib/libm/math/w_tgamma.c: In function ‘tgamma’:
../../../../../newlib/libm/math/w_tgamma.c:38:6: error: ‘errno’ undeclared (first use in this function)
   38 |      errno = EDOM;
      |      ^~~~~
../../../../../newlib/libm/math/w_tgamma.c:19:1: note: ‘errno’ is defined in header ‘<errno.h>’; did you forget to ‘#include <errno.h>’?
   18 | #include "fdlibm.h"
  +++ |+#include <errno.h>

../../../../../newlib/libm/math/w_tgamma.c:38:6: note: each undeclared identifier is reported only once for each function it appears in
   38 |      errno = EDOM;
      |      ^~~~~
../../../../../newlib/libm/math/w_tgamma.c:38:14: error: ‘EDOM’ undeclared (first use in this function)
   38 |      errno = EDOM;
      |              ^~~~
../../../../../newlib/libm/math/w_tgamma.c:40:14: error: ‘ERANGE’ undeclared (first use in this function)
   40 |      errno = ERANGE;
      |              ^~~~~~

It does after the following changes:

diff --git a/newlib/libm/math/w_tgamma.c b/newlib/libm/math/w_tgamma.c
index 0f90dd4c6..52d5d71d3 100644
--- a/newlib/libm/math/w_tgamma.c
+++ b/newlib/libm/math/w_tgamma.c
@@ -16,6 +16,7 @@
  */
 
 #include "fdlibm.h"
+#include <errno.h>
 
 #ifndef _DOUBLE_IS_32BITS
 
diff --git a/newlib/libm/math/wf_tgamma.c b/newlib/libm/math/wf_tgamma.c
index 80aacf757..504cb4c29 100644
--- a/newlib/libm/math/wf_tgamma.c
+++ b/newlib/libm/math/wf_tgamma.c
@@ -15,6 +15,7 @@
 
 #include "math.h"
 #include "fdlibm.h"
+#include <errno.h>
 
 #ifdef __STDC__
        float tgammaf(float x)
@@ -34,7 +35,6 @@
            errno = EDOM;
          else if (finite(x))
            errno = ERANGE;
-       }
        return y;
 #endif
 }

and my small test program gives:

zimmerma@tomate:/tmp/newlib-cygwin$ ./a.out 
x=-0x0p+0 y=-inf
x=-0x1.53f198fe3b278p+7 y=0x1.fd6d312572d9cp-1015

which is ok. I'll do some further tests.

Paul

  reply	other threads:[~2020-12-18  6:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 13:48 Paul Zimmermann
2020-12-16 20:31 ` Jeff Johnston
2020-12-17  7:29   ` Paul Zimmermann
2020-12-17 16:13     ` Keith Packard
2020-12-17 18:27       ` Jeff Johnston
2020-12-17 19:16         ` Keith Packard
2020-12-17 21:28           ` Jeff Johnston
2020-12-18  6:36             ` Paul Zimmermann [this message]
2020-12-18  8:42               ` Corinna Vinschen
2020-12-18  8:54                 ` Paul Zimmermann
2020-12-18  9:07                   ` Corinna Vinschen
2020-12-18 17:42                     ` Jeff Johnston
2020-12-18  8:37             ` Paul Zimmermann
  -- strict thread matches above, loose matches on Subject: below --
2020-12-15 13:35 Paul Zimmermann
2020-12-15 17:11 ` Jeff Johnston
2020-12-16  6:36   ` Paul Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mwsg8339jb.fsf@tomate.loria.fr \
    --to=paul.zimmermann@inria.fr \
    --cc=jjohnstn@redhat.com \
    --cc=keithp@keithp.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).