From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id B70AB3858412; Mon, 14 Feb 2022 13:44:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B70AB3858412 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Improve lgammaf range for very small cases X-Act-Checkin: newlib-cygwin X-Git-Author: Andoni Arregi X-Git-Refname: refs/heads/master X-Git-Oldrev: dd653423157b49ebe0c07f692cf8ba483b76e8b7 X-Git-Newrev: ec69debcb977d6395f9e91ee20133de473484e20 Message-Id: <20220214134422.B70AB3858412@sourceware.org> Date: Mon, 14 Feb 2022 13:44:22 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Feb 2022 13:44:22 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dec69debcb97= 7d6395f9e91ee20133de473484e20 commit ec69debcb977d6395f9e91ee20133de473484e20 Author: Andoni Arregi Date: Fri Feb 11 12:16:00 2022 +0100 Improve lgammaf range for very small cases =20 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=3D 0.0000000000e+00; *signgamp =3D -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 =3D -1; return -__ieee754_logf(-x);