From: "Keith Packard" <keithp@keithp.com>
To: Paul Zimmermann <Paul.Zimmermann@inria.fr>, newlib@sourceware.org
Subject: Re: issue with tgammaf
Date: Tue, 15 Sep 2020 10:28:19 -0700 [thread overview]
Message-ID: <87een3eyq4.fsf@keithp.com> (raw)
In-Reply-To: <mwy2lbxxeg.fsf@tomate.loria.fr>
[-- Attachment #1.1: Type: text/plain, Size: 436 bytes --]
Paul Zimmermann <Paul.Zimmermann@inria.fr> writes:
> Hi,
>
> in https://sourceware.org/pipermail/newlib/2020/017920.html I reported an
> issue with tgammaf(-0).
>
> With Newlib 3.3.0, there seems to be the same issue for negative subnormal
> values of the input, where tgammaf gives +inf instead of -inf.
We've been fixing a bunch of gamma problems; this is one that got missed
when the library is configured to report errno.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-libm-Make-tgamma-small-INFINITY.patch --]
[-- Type: text/x-diff, Size: 876 bytes --]
From 8cefdba40a4382de6b3f44a5d35880026727f1dd Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Tue, 15 Sep 2020 10:10:07 -0700
Subject: [PATCH] libm: Make tgamma(-small) = -INFINITY
Need to copy the argument sign to the output for tgamma(finite)
overflow case.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
newlib/libm/math/k_standard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/newlib/libm/math/k_standard.c b/newlib/libm/math/k_standard.c
index 906412ba7..beab51e16 100644
--- a/newlib/libm/math/k_standard.c
+++ b/newlib/libm/math/k_standard.c
@@ -331,7 +331,7 @@ static double zero = 0.0; /* used as const */
case 40:
case 140:
/* gamma(finite) overflow */
- retval = HUGE_VAL;
+ retval = copysign(HUGE_VAL, x);
errno = ERANGE;
break;
case 41:
--
2.28.0
[-- Attachment #1.3: Type: text/plain, Size: 15 bytes --]
--
-keith
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2020-09-15 17:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 8:21 Paul Zimmermann
2020-09-15 17:28 ` Keith Packard [this message]
2020-09-16 8:33 ` Paul Zimmermann
2020-09-16 15:13 ` Keith Packard
2020-09-17 7:18 ` Paul Zimmermann
2020-09-17 16:11 ` Keith Packard
2021-01-13 5:46 ` Paul Zimmermann
2021-01-13 6:38 ` Keith Packard
2021-01-13 7:52 ` Paul Zimmermann
2020-09-18 21:21 ` Jeff Johnston
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=87een3eyq4.fsf@keithp.com \
--to=keithp@keithp.com \
--cc=Paul.Zimmermann@inria.fr \
--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).