public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Improve lgammaf range for very small cases
@ 2022-02-14 13:44 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2022-02-14 13:44 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ec69debcb977d6395f9e91ee20133de473484e20
commit ec69debcb977d6395f9e91ee20133de473484e20
Author: Andoni Arregi <andoni.arregui@gtd-gmbh.de>
Date: Fri Feb 11 12:16:00 2022 +0100
Improve lgammaf range for very small cases
The original cut for small arguments at |x|<2**-70 (copied from the
double version) produces that when computing nadj we get a subnormal
number for t*x and thus, the division of pi/subnormal will be INF and
the logarithm of it too, which is wrong as a result for lgammaf in this
range.
The proposed new limit seems to be safe and has been tested to
produce accurate results.
(Courtesy of Andreas Jung, ESA)
Diff:
---
newlib/libm/math/erf_lgamma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/newlib/libm/math/erf_lgamma.c b/newlib/libm/math/erf_lgamma.c
index f88f63092..84d02159b 100644
--- a/newlib/libm/math/erf_lgamma.c
+++ b/newlib/libm/math/erf_lgamma.c
@@ -168,7 +168,7 @@ static float zero= 0.0000000000e+00;
*signgamp = -1;
return one/(x-x);
}
- if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */
+ if(ix<0x30800000) { /* |x|<2**-30, return -log(|x|) */
if(hx<0) {
*signgamp = -1;
return -__ieee754_logf(-x);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-14 13:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 13:44 [newlib-cygwin] Improve lgammaf range for very small cases Corinna Vinschen
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).