<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 24, 2017 at 6:43 PM, Nathaniel Smith <span dir="ltr"><<a href="mailto:njs@pobox.com" target="_blank">njs@pobox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class=""><div><div class="gmail_extra"><div class="gmail_quote">On Feb 24, 2017 5:29 PM, "David Mertz" <<a href="mailto:mertz@gnosis.cx" target="_blank">mertz@gnosis.cx</a>> wrote:<br type="attribution"><blockquote class="m_5622237263534357056quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Marc-André slightly misspelled the recent-ish addition of math.isclose(), but I agree that it is absolutely where a "nextafter" belongs.<div><br></div></div></blockquote></div></div></div></span></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class=""><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_5622237263534357056quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div></div></blockquote></div></div></div></span><div dir="auto">My 2c: I disagree -- numerical tolerance based closeness is fundamentally different than floating point representation based closeness </div></div></blockquote><div><br></div><div>agreed -- isclose() is a convenience function to provide folks a way to "do a reasonable thing" without delving into floating point representation issues, etc. INdeed, essentially the same approach could be used for Decimal and Fraction, though they aren't supported by math.isclose() due to the math module being written in C, and the rest of math being all about floats.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto">It's also a little weird to jump from nextafter to isclose, since AFAIK they have pretty much non-overlapping use cases... </div></div></blockquote><div><br></div><div>Exactly -- and you can tell by this this thread that confusion is easy with this stuff -- putting them together will only sow more confusion. </div><div><br></div><div>"Floating Point is Hard"</div><div><br></div><div>Note how many really smart people on this list say things like " I'm no expert in numerical analysis.. "</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto">* nextafter<br></div><div dir="auto">* a function for counting the number of ulps between two floats</div><div dir="auto">* a function for checking that two floats differ by at most N ulps</div><div dir="auto"><br></div><div dir="auto">I'm not enough of an expert on numerical analysis to have an opinion on how useful these would be for Python itself. They certainly are part of a complete IEEE754 implementation, and useful for exploring the details of how floats work, if nothing else.</div></div></blockquote><div><br></div><div>I think there is little question that these are useful for numerical analysis. I think the question is if enough people want to use Python for that kind of analysis to add it to the stdlib.</div><div><br></div><div>My tendency is to say yes -- if someone wants to write the code, it shouldn't be that hard to maintain -- it's mostly going to be calls to the underlying C lib, yes?</div><div><br></div><div>-CHB</div><div><br></div><div><br></div></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax<br>Seattle, WA 98115 (206) 526-6317 main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>