From: C Howland <cc1964t@gmail.com>
To: newlib@sourceware.org
Subject: Re: Fw: [PATCH 3/3] libm: Adjust errno/exception values for gamma/lgamma
Date: Thu, 27 Aug 2020 13:55:33 -0400 [thread overview]
Message-ID: <CANk6obTZtC8g9u4d+71JoFOBdmJ65tMNciwv7WNtypKhPgBe5g@mail.gmail.com> (raw)
In-Reply-To: <SN5P110MB0383012287522E8285674CAB9A550@SN5P110MB0383.NAMP110.PROD.OUTLOOK.COM>
> ------------------------------
> *From:* Newlib <newlib-bounces@sourceware.org> on behalf of Keith Packard
> via Newlib <newlib@sourceware.org>
> *Sent:* Wednesday, August 26, 2020 1:03 PM
> *To:* newlib@sourceware.org <newlib@sourceware.org>
> *Subject:* [PATCH 3/3] libm: Adjust errno/exception values for
> gamma/lgamma
>
>
>
>
> This makes all of gamma/lgamma functions match POSIX (and glibc) for
> errno and exception values for both gamma and lgamma functions.
>
> The big change is to support the exception/errno value differences for
> tgamma/lgamma for negative integer arguments. tgamma produces
> EDOM/FE_INVALID while lgamma produces ERANGE/FE_DIVBYZERO.
>
> This was done by splitting the lowest level __ieee754_lgamma*_r
> functions apart. The new lower-level ___ieee754_lgamma*_r functions
> can now produce exceptions which are correct for either lgamma or
> tgamma and use the value in the signgamp parameter to select which
> mode to operate in.
>
> All functions now return EDOM/FE_INVALID for -INFINITY, although POSIX
> doesn't specify this behavior for lgamma. It does match glibc at
> least.
>
I think you're looking at an old GLIBC. From my RHEL7 lgamma() man page:
" If the result overflows, a range error occurs, and the functions
return
HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively, with the correct
math‐
ematical sign.
...
BUGS
In glibc 2.9 and earlier, when a pole error occurs, errno is set
to
EDOM; instead of the POSIX-mandated ERANGE. Since version 2.10,
glibc
does the right thing."
POSIX has only pole and range errors listed for lgamma(), both of which
return ERANGE, so it is definitely improper to return EDOM. It should be
range, so ERANGE/FE_OVERFLOW is what it ought to be.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
>
>
next prev parent reply other threads:[~2020-08-27 17:55 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 17:03 [PATCH 0/3] libm: Clean up gamma functions Keith Packard
2020-08-26 17:03 ` [PATCH 1/3] libm: Fix sign value returned from __ieee754_lgamma*_r(-0) Keith Packard
2020-08-26 17:03 ` [PATCH 2/3] libm: Remove __ieee754_gamma_r variants Keith Packard
2020-08-26 18:20 ` Corinna Vinschen
2020-08-26 19:10 ` Keith Packard
2020-08-27 7:24 ` Corinna Vinschen
2020-08-27 17:05 ` Keith Packard
2020-08-28 8:19 ` Corinna Vinschen
2020-08-28 8:34 ` Corinna Vinschen
2020-09-01 16:33 ` Fabian Schriever
2020-09-01 17:23 ` Keith Packard
2020-09-02 8:03 ` Corinna Vinschen
2020-09-02 20:37 ` Keith Packard
2020-09-03 8:04 ` Corinna Vinschen
2020-09-03 15:59 ` Brian Inglis
2020-09-03 21:25 ` Keith Packard
2020-09-03 22:09 ` Brian Inglis
2020-09-04 0:01 ` Keith Packard
2020-09-04 0:27 ` Brian Inglis
2020-09-04 1:37 ` Keith Packard
2020-09-04 13:03 ` Corinna Vinschen
2020-09-04 16:19 ` Keith Packard
2020-08-26 17:03 ` [PATCH 3/3] libm: Adjust errno/exception values for gamma/lgamma Keith Packard
[not found] ` <SN5P110MB0383012287522E8285674CAB9A550@SN5P110MB0383.NAMP110.PROD.OUTLOOK.COM>
2020-08-27 17:55 ` C Howland [this message]
2020-08-27 19:28 ` Fw: " Brian Inglis
[not found] ` <SN5P110MB0383186ECD9B028A4B0E2ECC9A550@SN5P110MB0383.NAMP110.PROD.OUTLOOK.COM>
2020-08-27 17:43 ` Fw: [PATCH 0/3] libm: Clean up gamma functions C Howland
2020-08-27 23:59 ` Keith Packard
2020-08-28 2:03 ` Brian Inglis
2020-08-28 3:13 ` Keith Packard
2020-08-28 3:51 ` Brian Inglis
2020-08-28 17:13 ` Keith Packard
2020-08-28 18:29 ` Joseph Myers
2020-08-28 19:32 ` Keith Packard
2020-08-28 19:53 ` Joseph Myers
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=CANk6obTZtC8g9u4d+71JoFOBdmJ65tMNciwv7WNtypKhPgBe5g@mail.gmail.com \
--to=cc1964t@gmail.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).