Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73415

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

References <lnug3b$k2v$1@ger.gmane.org> <CAPM-O+zuBfLBE=tVhb=fYC+yr3W+a4-wWauqQ4xkH3xZSenfVw@mail.gmail.com>
Date 2014-06-19 13:50 +0200
Subject Re: can I get 0./0. to return nan instead of exception?
From Chris “Kwpolska” Warrick <kwpolska@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.11143.1403178645.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Jun 19, 2014 at 1:31 PM, Joel Goldstick
<joel.goldstick@gmail.com> wrote:
>
> On Jun 19, 2014 7:05 AM, "Neal Becker" <ndbecker2@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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: can I get 0./0. to return nan instead of exception? Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-06-19 13:50 +0200
  Re: can I get 0./0. to return nan instead of exception? wxjmfauth@gmail.com - 2014-06-19 06:17 -0700

csiph-web