Movatterモバイル変換


[0]ホーム

URL:


[Python-ideas] math.nextafter

Chris Barkerchris.barker at noaa.gov
Tue Feb 28 12:55:06 EST 2017


On Fri, Feb 24, 2017 at 6:43 PM, Nathaniel Smith <njs at pobox.com> wrote:> On Feb 24, 2017 5:29 PM, "David Mertz" <mertz at gnosis.cx> wrote:>> Marc-André slightly misspelled the recent-ish addition of math.isclose(),> but I agree that it is absolutely where a "nextafter" belongs.>>> My 2c: I disagree -- numerical tolerance based closeness is fundamentally> different than floating point representation based closeness>agreed -- isclose() is a convenience function to provide folks a way to "doa reasonable thing" without delving into floating point representationissues, etc. INdeed, essentially the same approach could be used forDecimal and Fraction, though they aren't supported by math.isclose() due tothe math module being written in C, and the rest of math being all aboutfloats.It's also a little weird to jump from nextafter to isclose, since AFAIK> they have pretty much non-overlapping use cases...>Exactly -- and you can tell by this this thread that confusion is easy withthis stuff -- putting them together will only sow more confusion."Floating Point is Hard"Note how many really smart people on this list say things like " I'm noexpert in numerical analysis.. "* nextafter> * a function for counting the number of ulps between two floats> * a function for checking that two floats differ by at most N ulps>> 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.>I think there is little question that these are useful for numericalanalysis. I think the question is if enough people want to use Python forthat kind of analysis to add it to the stdlib.My tendency is to say yes -- if someone wants to write the code, itshouldn't be that hard to maintain -- it's mostly going to be calls to theunderlying C lib, yes?-CHB-- Christopher Barker, Ph.D.OceanographerEmergency Response DivisionNOAA/NOS/OR&R            (206) 526-6959   voice7600 Sand Point Way NE   (206) 526-6329   faxSeattle, WA  98115       (206) 526-6317   main receptionChris.Barker at noaa.gov-------------- next part --------------An HTML attachment was scrubbed...URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170228/7edd6156/attachment-0001.html>


More information about the Python-ideasmailing list

[8]ページ先頭

©2009-2026 Movatter.jp