On Sun, Oct 18, 2020 at 9:49 AM Wes Turner <wes.tur...@gmail.com> wrote:
> Actually, where in the docs is it clarified which parts of IEEE-754 are > obeyed by Python? > Not sure, but I think the answer is "Most places" -- that is, cPython depends on teh compiler, math library, and hardware, most of which these days are IEEE-754 compliant. To my understanding (according to Wikipedia), IEEE-754 returns +- infinity > for DivideByZeroError and for FloatOverflow. > I think the answer is that IEEE-754 specifies that +- Inf be returned If a value is returned at all. That is, raising an Exception does not violate the standard, but returning any other value would. And by the way, I think asking Python to do anything other than IEE-754 for floats would be a VERY heavy lift, and never get anywhere -- as above, most of it happens at lower levels than Python. -CHB > ... > > It's a rare use case; but one use case where this matters could be code > that is mutating and selecting (evolutionary algorithms) to evolve a > **symbolic** function. It could be documented that Python code could be so > permuted for infinity and never find the best fitting function due to this > limit. > > A vectorizable CAS (with support for variable axioms in order to support > things like e.g. transfinite and surreal numbers) would be a better fit. > > But that's way OT for (though likely an eventual tangential implication > of) this discussion of a **float, IEEE-754*** infinity constant; so I'll > stop talking now. > > On Sun, Oct 18, 2020 at 12:28 PM Wes Turner <wes.tur...@gmail.com> wrote: > >> Thank you for the explanation. I have nothing more to add to this >> discussion >> >> On Sun, Oct 18, 2020, 4:47 AM Steven D'Aprano <st...@pearwood.info> >> wrote: >> >>> On Sun, Oct 18, 2020 at 03:26:11AM -0400, Wes Turner wrote: >>> >>> > assert math.inf**0 == 1 >>> > assert math.inf**math.inf == math.inf >>> >>> Wes, I don't understand what point you are trying to make here. Are you >>> agreeing with that behaviour? Disagreeing? Thought it was so surprising >>> that you can't imagine why it happens? Something else? >>> >>> If you find a behaviour which is forbidden or contradicted by the >>> documentation, then you should report it as a bug, but just >>> demonstrating what the behaviour is with no context isn't helpful. >>> >>> Please remember that the things which are blindingly obvious to you >>> because you just thought them are not necessarily obvious to those of us >>> who aren't inside your head :-) >>> >>> Python's float INFs and NANs (mostly?) obey the rules of IEEE-754 >>> arithmetic. Those rules are close to the rules for the extended Real >>> number line, with a point at both positive and negative infinity. >>> >>> These rules are not necessarily the same as the rules for transfinite >>> arithmetic, or the projective number line with a single infinity, or >>> arithmetic on cardinal numbers, or surreal numbers. >>> >>> Each of these number systems have related, but slightly different, >>> rules. For example, IEEE-754 has a single signed infinity and 2**INF is >>> exactly equal to INF. But in transfinite arithmetic, 2**INF is strictly >>> greater than INF (for every infinity): >>> >>> 2**aleph_0 < aleph_1 >>> 2**aleph_1 < aleph_2 >>> 2**aleph_2 < aleph_3 >>> >>> and so on, with no limit. There is no greatest aleph, there is always a >>> larger one. >>> >>> Do you have a concrete suggestion you would like to make for a change or >>> new feature for Python? If not, I suggest that this thread is going >>> nowhere. >>> >>> >>> -- >>> Steve >>> _______________________________________________ >>> Python-ideas mailing list -- python-ideas@python.org >>> To unsubscribe send an email to python-ideas-le...@python.org >>> https://mail.python.org/mailman3/lists/python-ideas.python.org/ >>> Message archived at >>> https://mail.python.org/archives/list/python-ideas@python.org/message/U5WXW3WTNRNWV5PEADF6CDZC6FFBBUJG/ >>> Code of Conduct: http://python.org/psf/codeofconduct/ >>> >> _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/ODANBEU6GW5A5SPEXPDL2ZLTY2QIFRLE/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ESFEQJ3T2ZIENX5RFTLZZNYSF4J77OGL/ Code of Conduct: http://python.org/psf/codeofconduct/