can I get 0./0. to return nan instead of exception?

Chris “Kwpolska” Warrick kwpolska at gmail.com
Thu Jun 19 07:50:37 EDT 2014


On Thu, Jun 19, 2014 at 1:31 PM, Joel Goldstick
<joel.goldstick at gmail.com> wrote:
>
> On Jun 19, 2014 7:05 AM, "Neal Becker" <ndbecker2 at gmail.com> wrote:
>>
>> Can I change behavior of py3 to return nan for 0./0. instead of raising an
>> exception?
>
> There is no nan in python.

Wrong:

>>> float('nan')
nan
>>>

also:

https://docs.python.org/2/library/math.html#math.isnan

> Check if the float x is a NaN (not a number). For more information on NaNs, see the IEEE 754 standards.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense



More information about the Python-list mailing list