Actually, where in the docs is it clarified which parts of IEEE-754 are obeyed by Python?
Or where should this be clarified?

To my understanding (according to Wikipedia), IEEE-754 returns +- infinity for DivideByZeroError and for FloatOverflow.

...

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.turner@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 <steve@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

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-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/