From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20193 invoked from network); 11 Aug 2021 22:48:42 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 11 Aug 2021 22:48:42 -0000 Received: (qmail 3633 invoked by uid 550); 11 Aug 2021 22:48:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 3614 invoked from network); 11 Aug 2021 22:48:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexgo.de; s=vfde-smtpout-mb-15sep; t=1628722109; bh=VFZq1+o/uXSzUn3xGgNQxetsNZdZnMj2hR/VczyiDko=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=fD+6APXNTJoLd233B8u3rhF93sLDwGS/5vG8yahwc55llIhvdlC/ruFxJYOR3ZkBx BMIAWp0Cmr3MMLlH3vVOzEdGK5CaAN52ZEvLPuHc/8OHDBmq58O7ODFyDMLxm53L04 eVeVhhvgWf+MoKISQDYavUTBGz149dCCYLjk+bBk= Message-ID: <13F146D849AC41A6821080A0307B8796@H270> From: "Stefan Kanthak" To: "Szabolcs Nagy" , "Rich Felker" Cc: References: <0C6AAAD55DA44C6189B2FF4F5FB2C3E7@H270> <20210810213455.GB37904@port70.net> <5C60D05C95724A36B3DB9942D06CFE5F@H270> <20210811024010.GA13220@brightrain.aerifal.cx> <7143269BEC424DE6A3B0218C4268C4C8@H270> <20210811160938.GB13220@brightrain.aerifal.cx> <20210811175723.GC13220@brightrain.aerifal.cx> <20210811221610.GE37904@port70.net> In-Reply-To: <20210811221610.GE37904@port70.net> Date: Thu, 12 Aug 2021 00:43:36 +0200 Organization: Me, myself & IT MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6002.18197 X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.24158 X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 1201 X-purgate-ID: 155817::1628722108-00007455-603FFBC9/0/0 Subject: Re: [musl] [PATCH] Properly simplified nextafter() Szabolcs Nagy wrote: >* Rich Felker [2021-08-11 13:57:23 -0400]: >> On Wed, Aug 11, 2021 at 06:50:28PM +0200, Stefan Kanthak wrote: >> > Rich Felker wrote: >> > > static __inline unsigned __FLOAT_BITS(float __f) >> > > { >> > > union {float __f; unsigned __i;} __u; >> > > __u.__f = __f; >> > > return __u.__i; >> > > } >> > > >> > > #define isnan(x) ( \ >> > > sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \ >> > > sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \ >> > > __fpclassifyl(x) == FP_NAN) >> > > >> > > So, nope. >> > >> > GCC typically uses its __builtin_isnan() for isnan(), which doesn't >> > use integer instructions or reloads: >> >> That's only if you #define isnan(x) __builtin_isnan(x) > > even then it should use int arithmetics, see below [...] > it is also wrong: isnan must not signal for signaling nan. ARGH: I recommend to read the subject first, then the C standard and recall how nextafter() is supposed to handle signalling NANs! Stefan