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


Groups > comp.lang.python > #83389

Re: where in Nan defined

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'float': 0.07; 'overflow': 0.09; 'python': 0.11; 'jan': 0.12; 'exponent': 0.16; 'fallback': 0.16; 'inf': 0.16; 'infinity,': 0.16; 'nan': 0.16; 'subject:where': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'fairly': 0.24; 'question': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'constant': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'fri,': 0.33; 'received:google.com': 0.35; 'should': 0.36; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'worry': 0.60; 'first': 0.61; '2015': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=D/lwK9rof1/I5GJwqE8Wxc9MNdWmL6eYUJCnL6fUWwM=; b=NnNqZajO1e1gARvrl9wGd02vtrwZOUmhF8l6LSuS6BhyxHRlDYMolLuae9G2cpb14C EhJNemDV/6YdUkkoQ9E++HuYOoPYaVHAMOvb2wXFuUNynve/F+hFs6HZw8R1ePtEuDsI KUCOdfR8Mx3GgLBZck0F3FoUSS6dwvVdM007dFhfx41jvPrhryl1n5+qFoPNzduI/wpZ 4gHpyIdbPBpdatpT5yfaZzaUaTX3/MBdIFSpKjU/OpgbH4nVdRDKOMTR4WjZ0Nn1TK2+ d0agbvzqCv158d+xrj2vzj3f3Mh1k85NHZHMzK/ULlWh4cx/HyZGVry48POhd41/zbO3 c1Iw==
X-Received by 10.66.97.6 with SMTP id dw6mr19616127pab.114.1420769605828; Thu, 08 Jan 2015 18:13:25 -0800 (PST)
MIME-Version 1.0
In-Reply-To <CAPTjJmoN+PWTTYkc_DaADgwAeVc9QVSK8S1sJn9O28ugrDYExA@mail.gmail.com>
References <m8m3et$1gu$2@speranza.aioe.org> <mailman.17472.1420727095.18130.python-list@python.org> <87zj9te3tz.fsf@elektro.pacujo.net> <qotk30xjpib.fsf@ruuvi.it.helsinki.fi> <mailman.17477.1420729115.18130.python-list@python.org> <54af32f4$0$12990$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmoN+PWTTYkc_DaADgwAeVc9QVSK8S1sJn9O28ugrDYExA@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 8 Jan 2015 19:12:45 -0700
Subject Re: where in Nan defined
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.17494.1420769609.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420769609 news.xs4all.nl 2898 [2001:888:2000:d::a6]:57747
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83389

Show key headers only | View raw


On Thu, Jan 8, 2015 at 7:07 PM, Chris Angelico <rosuav@gmail.com> wrote:
> On Fri, Jan 9, 2015 at 12:46 PM, Steven D'Aprano
>> The fallback rule I use when float('nan') fails is
>>
>>     INF = 1e3000  # Hopefully, this should overflow to INF.
>>     NAN = INF-INF  # And this hopefully will give a NaN.
>
> The first question is "will 1eN overflow to inf?". I'm fairly sure
> Python guarantees that an unrepresentable float constant will be
> treated as infinity, so all you have to do is crank up the exponent
> any time you suspect it'll be representable.

Or to never have to worry about it:

INF = 1e400
while not math.isinf(INF):
    INF *= INF

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


Thread

where in Nan defined maurog <qualsivoglia@dovetipare.nz> - 2015-01-08 14:15 +0000
  Re: where in Nan defined Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-08 07:24 -0700
    Re: where in Nan defined Marko Rauhamaa <marko@pacujo.net> - 2015-01-08 16:37 +0200
      Re: where in Nan defined Chris Angelico <rosuav@gmail.com> - 2015-01-09 01:45 +1100
        Re: where in Nan defined Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-08 16:55 +0200
      Re: where in Nan defined Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-08 16:50 +0200
        Re: where in Nan defined Chris Angelico <rosuav@gmail.com> - 2015-01-09 01:58 +1100
          Re: where in Nan defined Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-09 12:46 +1100
            Re: where in Nan defined Chris Angelico <rosuav@gmail.com> - 2015-01-09 13:07 +1100
            Re: where in Nan defined Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-08 19:12 -0700
            Re: where in Nan defined Chris Angelico <rosuav@gmail.com> - 2015-01-09 13:25 +1100
  Re: where in Nan defined Chris Angelico <rosuav@gmail.com> - 2015-01-09 01:28 +1100

csiph-web