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?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <kwpolska@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.042
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'python.': 0.02; 'float': 0.07; 'utf-8': 0.07; 'cc:addr:python-list': 0.11; '754': 0.16; 'exception?': 0.16; 'nan': 0.16; 'nans,': 0.16; 'subject:exception': 0.16; 'wrote:': 0.18; '(not': 0.18; 'thu,': 0.19; '>>>': 0.22; 'cc:addr:gmail.com': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:python': 0.33; 'sense': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'raising': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'pm,': 0.38; 'subject:can': 0.39; 'from:charset:utf-8': 0.61; 'information': 0.63; 'more': 0.64; 'skip:\xe2 10': 0.65; 'to:addr:gmail.com': 0.65; 'subject:. ': 0.67; '8bit%:43': 0.74; 'behavior': 0.77; 'subject:get': 0.81; 'standards.': 0.84; 'joel': 0.91; 'url:tk': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=EIyBOD2EHo8Eu2jR5VYGc+uILTG9V8qV9uw/XIqeqKE=; b=hMlgyEG+t9KgFoAR1H/VzSRnwuCXitYAC792IDmNPUn40qXqPc0HqUuFQB6OJ3yIuh G96+2EUf6LiLZ44EaOcqfPXv8jYkIydSyTHazEI5I2G2mmV90sWQcnbMJnoCCtDFs90C I8ej0YItXnTyUxDCgscSCIGRPF/lwzZxJ6Q9qZyo5roaZcmG+QETco4XKwZzcbZOSiEn 2Vd6YJlV4GMJZ6fE/kwhL5S3sXDdSehz8R7u6xiI2rkaQiHiLUeiGl+YNBv7uBljAgV7 E9Uz2wxPqDSQym1xrnqxZpTRGrsFLpQvHYJXDEiMTLkaeJ+X7Iw5KOzCzvQiNC8YAMRw o1OQ==
MIME-Version 1.0
X-Received by 10.50.124.4 with SMTP id me4mr6962678igb.39.1403178637554; Thu, 19 Jun 2014 04:50:37 -0700 (PDT)
In-Reply-To <CAPM-O+zuBfLBE=tVhb=fYC+yr3W+a4-wWauqQ4xkH3xZSenfVw@mail.gmail.com>
References <lnug3b$k2v$1@ger.gmane.org> <CAPM-O+zuBfLBE=tVhb=fYC+yr3W+a4-wWauqQ4xkH3xZSenfVw@mail.gmail.com>
Date Thu, 19 Jun 2014 13:50:37 +0200
Subject Re: can I get 0./0. to return nan instead of exception?
From Chris “Kwpolska” Warrick <kwpolska@gmail.com>
To Joel Goldstick <joel.goldstick@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc Neal Becker <ndbecker2@gmail.com>, python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11143.1403178645.18130.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1403178645 news.xs4all.nl 2946 [2001:888:2000:d::a6]:55531
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73415

Show key headers only | 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