From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/15001 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] fdim(), fdimf() and fdiml() radically simplified Date: Wed, 11 Dec 2019 11:39:36 +0100 Message-ID: <20191211103935.GM23985@port70.net> References: <530261068B3547C5A40104AC03005B28@H270> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="52743"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: musl@lists.openwall.com To: Stefan Kanthak Original-X-From: musl-return-15017-gllmg-musl=m.gmane.org@lists.openwall.com Wed Dec 11 11:39:51 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1iezPK-000DX0-Te for gllmg-musl@m.gmane.org; Wed, 11 Dec 2019 11:39:51 +0100 Original-Received: (qmail 23922 invoked by uid 550); 11 Dec 2019 10:39:48 -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 23901 invoked from network); 11 Dec 2019 10:39:48 -0000 Mail-Followup-To: Stefan Kanthak , musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <530261068B3547C5A40104AC03005B28@H270> Xref: news.gmane.org gmane.linux.lib.musl.general:15001 Archived-At: * Stefan Kanthak [2019-12-11 10:55:01 +0100]: > Yet another optimisation/simplification in the math subtree. these changes have incorrect fenv behaviour (they signal the invalid exception on qnan input), the result is fine though. > > JFTR: I'm NOT subscribed to your mailing list, so CC: me in replies! > > --- -/src/math/fdim.c > +++ +/src/math/fdim.c > @@ -3,8 +3,4 @@ > double fdim(double x, double y) > { > - if (isnan(x)) > - return x; > - if (isnan(y)) > - return y; > - return x > y ? x - y : 0; > + return x <= y ? 0.0 : x - y; > } > > --- -/src/math/fdimf.c > +++ +/src/math/fdimf.c > @@ -3,8 +3,4 @@ > float fdimf(float x, float y) > { > - if (isnan(x)) > - return x; > - if (isnan(y)) > - return y; > - return x > y ? x - y : 0; > + return x <= y ? 0.0 : x - y; > } > > --- -/src/math/fdiml.c > +++ +/src/math/fdiml.c > @@ -10,8 +10,4 @@ > long double fdiml(long double x, long double y) > { > - if (isnan(x)) > - return x; > - if (isnan(y)) > - return y; > - return x > y ? x - y : 0; > + return x <= y ? 0.0 : x - y; > }