|
Message-ID: <alpine.LRH.2.02.2108160105200.30419@key0.esi.com.au> Date: Mon, 16 Aug 2021 01:10:21 +1000 (AEST) From: Damian McGuckin <damianm@....com.au> To: Rich Felker <dalias@...c.org> cc: musl@...ts.openwall.com, Szabolcs Nagy <nsz@...t70.net> Subject: Re: [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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.