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.3 required=5.0 tests=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 5059 invoked from network); 15 Aug 2021 15:10:39 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 15 Aug 2021 15:10:39 -0000 Received: (qmail 7301 invoked by uid 550); 15 Aug 2021 15:10:36 -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 7280 invoked from network); 15 Aug 2021 15:10:35 -0000 X-Authentication-Warning: key0.esi.com.au: damianm owned process doing -bs Date: Mon, 16 Aug 2021 01:10:21 +1000 (AEST) From: Damian McGuckin To: Rich Felker cc: musl@lists.openwall.com, Szabolcs Nagy In-Reply-To: <20210815140310.GG13220@brightrain.aerifal.cx> Message-ID: References: <0C6AAAD55DA44C6189B2FF4F5FB2C3E7@H270> <20210810213455.GB37904@port70.net> <20210814234612.GH37904@port70.net> <367A4018B58A4E308E2A95404362CBFB@H270> <20210815140310.GG13220@brightrain.aerifal.cx> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Subject: Re: [musl] [PATCH #2] Properly simplified nextafter() On Sun, 15 Aug 2021, Rich Felker wrote: >> I did a quick check and ran the above code for some test cases: >> >> nextafter(-9.7500000000e+01, 3.5000000000e+01) = -9.7500000000e+01 >> yourpatch(-9.7500000000e+01, 3.5000000000e+01) = -9.7500000000e+01 >> >> The error is 2.8421709430e-14 >> >> nextafter(-9.7500000000e+01, -3.5000000000e+01) = -9.7500000000e+01 >> yourpatch(-9.7500000000e+01, -3.5000000000e+01) = -9.7500000000e+01 >> >> The error is 2.8421709430e-14 > > I don't follow; are you claiming Stefan's patch introduces an error > here? Yes. I have suggested a change which solves the problem. > The outputs you printed show the exact same behavior before and > after but it's possible you printed them wrong. The nextafter function > is bit-exact; The bits from nextafter from GLIBC match those of MUSL for that case. But the bits from nextafter from GLIBC do not match those of Stefan's patch for the same case. > it does not have floating point error (inexactness) > unless the implementation is buggy. >> nextafter(-inf, inf) = -1.7976931349e+308 Correct >> yourpatch(-inf, inf) = -nan Incorrect >> >> This is against standard GLIB. > > glibc I assume you mean? Yes. Sorry. FInger<->Brain miscommunications. > In any case yes this looks like a bug in the patch. I believe so. Which I think Szabolcs has also suggested is the case. Stay safe - Damian Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037 Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here Views & opinions here are mine and not those of any past or present employer