On Tue, Nov 24, 2020 at 9:05 AM Steven D'Aprano <st...@pearwood.info> wrote:
>
> On Mon, Nov 23, 2020 at 04:26:20PM -0500, Wes Turner wrote:
>
> > Is there a different IEEE spec or CAS that distinguishes between 1/x and
> > 2/x where x=0?
>
> No. x/0.0 would either signal an error (in Python terms: raise an
> exception) or return a NAN. The specific NAN it might return is not set
> by the IEEE-754 standard.

>>> from numpy import float64 as f
>>> f(1)/f(0)
<stdin>:1: RuntimeWarning: divide by zero encountered in double_scalars
inf
>>> f(1)/-f(0)
-inf

ChrisA
_______________________________________________
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/A2R5DU4I4UUKYO4SRMS6NY7XTM44A6QN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to