Is there a different IEEE spec or CAS that distinguishes between 1/x and
2/x where x=0?

assert 1/0 != 2/0 != math.inf/0

On Mon, Nov 23, 2020, 2:44 PM <johnmelendow...@gmail.com> wrote:

> IEEE 754 is incredibly consistent with mathematics.
>
> The easiest way to determine if a float operation would return inf, -inf,
> or NaN is to quite literally make an expression and take the limit of it as
> a certain variable approaches infinity.
>
> 0/0, inf/inf, 0*inf, inf-inf  are standard Indeterminant Forms (IDF). If
> you are taking a limit, and come across this the general procedural to
> algebraically manipulate to remove the IDF, or apply L'Hospital. If after
> those attempts, you are still an IDF then that's that. In IEEE 754, an IDF
> is represented as a NaN.
>
> There are some special cases, wiki would describe 0^0 1^inf and infinity^0
> as IDF through certain manipulations. However, I think most people would
> argue otherwise and IEEE 754 handles them accordingly, which actually
> evaluates them  (or maybe its language specific, both Matlab and Numpy
> return 1, 1, and 1 respectively which is correct to me).
>
> Limits that turn into infinity are quite literally represented by infinity
> in IEEE 754. So limit 1/x as x -> 0 is infinity.  1/x as x -> infinity is
> zero or as close to zero as IEEE 754 allows.
>
> Very interesting example is log(0)
>
> log(x) as x->0 = -inf
>
> Which mathematically makes sense. As log(x) is asking e raised to what
> value a produces x. In other words, e^(a) = x or e^(a) = 0
>
> Well the easiest thing to do is choose a << 0 i.e. 1/e^(a) and what would
> bring that to 0? making a sufficiently large hence -inf
>
> Base python should be consistent with IEEE 754 in my opinion.
> _______________________________________________
> 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/JUGC7SCTVVYUF2J7B2L5S57JJWDXV4K7/
> 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/RIRC5ZHN5GKFXD5XBFASHSUNK4JDBMLD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to