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


Groups > comp.lang.python > #73415 > unrolled thread

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

Started byChris “Kwpolska” Warrick <kwpolska@gmail.com>
First post2014-06-19 13:50 +0200
Last post2014-06-19 06:17 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

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

FromChris “Kwpolska” Warrick <kwpolska@gmail.com>
Date2014-06-19 13:50 +0200
SubjectRe: can I get 0./0. to return nan instead of exception?
Message-ID<mailman.11143.1403178645.18130.python-list@python.org>
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

[toc] | [next] | [standalone]


#73422

Fromwxjmfauth@gmail.com
Date2014-06-19 06:17 -0700
Message-ID<a9e20b87-9f03-4540-b98f-4384c30cbe85@googlegroups.com>
In reply to#73415
Le jeudi 19 juin 2014 13:50:37 UTC+2, Chris "Kwpolska" Warrick a écrit :
> 
> > Check if the float x is a NaN (not a number). [...]


=============

Before or after you compute a division?

(Or are you applying the Flexible String Representation logic?)

jmf

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web