From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9463 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] math: fix expf(-NAN) to return -NAN instead of 0 Date: Fri, 4 Mar 2016 22:40:31 +0100 Message-ID: <20160304214031.GN29662@port70.net> References: <20160304213753.GM29662@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1457127652 8856 80.91.229.3 (4 Mar 2016 21:40:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Mar 2016 21:40:52 +0000 (UTC) To: musl@lists.openwall.com, Petr Hosek Original-X-From: musl-return-9476-gllmg-musl=m.gmane.org@lists.openwall.com Fri Mar 04 22:40:47 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1abxSn-0004h7-78 for gllmg-musl@m.gmane.org; Fri, 04 Mar 2016 22:40:45 +0100 Original-Received: (qmail 3980 invoked by uid 550); 4 Mar 2016 21:40:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 3962 invoked from network); 4 Mar 2016 21:40:43 -0000 Mail-Followup-To: musl@lists.openwall.com, Petr Hosek Content-Disposition: inline In-Reply-To: <20160304213753.GM29662@port70.net> User-Agent: Mutt/1.5.24 (2015-08-30) Xref: news.gmane.org gmane.linux.lib.musl.general:9463 Archived-At: * Szabolcs Nagy [2016-03-04 22:37:53 +0100]: > expf(-NAN) was treated as expf(-large) which unconditionally > returns +0, so special case +-NAN. > > reported by Petr Hosek. > --- > src/math/expf.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/math/expf.c b/src/math/expf.c > index 16e9afe..4a742e4 100644 > --- a/src/math/expf.c > +++ b/src/math/expf.c > @@ -39,6 +39,8 @@ float expf(float x) > > /* special cases */ > if (hx >= 0x42aeac50) { /* if |x| >= -87.33655f or NaN */ in the comment -87... should be 87... but i didnt want to include that into the bug fix > + if (hx > 0x7f800000) /* +-NaN */ > + return x; > if (hx >= 0x42b17218 && !sign) { /* x >= 88.722839f */ > /* overflow */ > x *= 0x1p127f; > -- > 2.7.0