Re: issue with tgammaf
Keith Packard via Newlib <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Paul Zimmermann <[email protected]> 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. -- -keith
0001-libm-Make-tgamma-small-INFINITY.patch
(text/x-diff, 847 B)
From 8cefdba40a4382de6b3f44a5d35880026727f1dd Mon Sep 17 00:00:00 2001 From: Keith Packard <[email protected]> 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 <[email protected]> --- 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
signature.asc
(application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAl9g+bMACgkQ2yIaaQAA ABFL4A//cLpVE0AE7zfKIaCjXqT0MtVgKbmuh+WMyFwF42ZIX55Iq7TZMtcGZAbH /zj5BLncxT/s2/5uVR2i+m/CTZuWUiJYkpjVzI0gN2patI/Vpj3HM2SdjjRQrZaR nioadoldDz8d9BWrK+2Gl8V5+TgJy0YobBHUnG7Tg2zK+pssZokjhu3Dgzt3K08F 144EaR3W2gGwWZCTZVvD8wcFN2AzIZ0QHOMc3BvEsMYkAiR2S/59w1kocc3o1Kc+ Kx932/wcO3VNCFN/Q+ig6B9cREBrqUKd/EyMlot/oV7+WJv8FuJMdavdERLPTOAD CGsoxbOTrCyJKKtL+dS/wV7Pq9x1PcKPby980LpCx8EZOqFdnTreCNDMFxamuTvG lyX5KlKMivmZWUy47vr4B6ZweKJd6KL+7QIDlcnpFZmr6BVC0HHOV8CT2MVFSrBC LYDVAFBcdSqDIwL7M4D994Wus9geaQTl1yiyfRkxc/RYPzqlpNxfQwBuxIMB1oHn pD1qLrus2TzlH5qdP/q3Bm3O2uhVlOkiIce1ZUzwwRwjZR6tf4E5aqMskm37w36H MVjWvyCbzEUoeyS9vF/rTyoRRGSYlKbsfKKkNUgpB0k2DjU+4QDILuCxryJlGCKW yYumHi7GVBijgHpwaBD7IYsgiWfOZknUL9DhWT46L3/BXzRuzwE= =Ba8Q -----END PGP SIGNATURE-----