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


Groups > comp.lang.python > #6784

Re: float("nan") in set or as key

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'wed,': 0.03; 'ascii': 0.07; 'defines': 0.07; 'python': 0.08; "it'd": 0.09; 'pm,': 0.10; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'wrote:': 0.14; 'defined': 0.14; "'int'": 0.16; "'long'": 0.16; "'real": 0.16; "2's": 0.16; '8-bit': 0.16; 'angelico': 0.16; 'changed,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'integers.': 0.16; 'precision,': 0.16; 'saying.': 0.16; 'subject:key': 0.16; 'subject:set': 0.16; 'obviously': 0.17; '(which': 0.20; 'header:In-Reply-To:1': 0.21; 'right.': 0.22; '(where': 0.23; 'definition': 0.26; 'wondering': 0.28; 'message- id:@mail.gmail.com': 0.28; '(the': 0.28; 'received:209.85.214': 0.28; 'true,': 0.29; 'carl': 0.30; 'looks': 0.31; "didn't": 0.31; "can't": 0.32; 'scale': 0.32; 'to:addr:python-list': 0.33; 'asking': 0.33; 'things': 0.33; 'rather': 0.34; 'chris': 0.34; 'done.': 0.34; 'there': 0.35; 'defining': 0.35; 'sense,': 0.35; 'using': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.37; 'floating': 0.37; 'model': 0.37; 'reasons': 0.37; 'put': 0.37; 'think': 0.38; 'could': 0.38; 'but': 0.38; 'data': 0.38; 'implemented': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'received:209': 0.39; 'system.': 0.39; 'to:addr:python.org': 0.39; 'current': 0.40; "couldn't": 0.40; 'meaning': 0.40; 'best': 0.60; 'power': 0.61; 'therefore,': 0.63; 'details': 0.64; 'problematic': 0.84; 'thereof': 0.84; 'standing': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=SXzCjiVuEvxLyLoBTn/Wzk2W653wGYKKY4XpeHm1eLk=; b=t8fwaKt483NEVROYnR8z6XfViNpHyY1AjeV4VAQyDdS+tdfcTsEtOF9Bn4h/WxQAgU g678Xox9uRCVRuFCwiVV4LVGjcvLbkemuG88ghBIFmZpE/sE3EoaV3GtFuq1S7dWkuCk R1XXaXcgUM7aITmzuTBpa4lk/t8NrXv4SkYgk=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=XTVjsM05prtT7LQP8FwKnvIhi6alhwcoQ6xSptGgq5EhSmXkNJRtFUD1jfLamvoVp/ BHOYTf9lODylma//6fYnddIaAbONEIUhyQtCZjczsQKwLwqVDBnfx1Sc1AJVJohKkx5l imBH2QL8FrbRXN3LvyBTqi2y4lmf3/A1evXUE=
MIME-Version 1.0
In-Reply-To <b7b526f5-c839-4b3e-8e00-eee8a19078ce@glegroupsg2000goo.googlegroups.com>
References <mailman.2351.1306897552.9059.python-list@python.org> <b7b526f5-c839-4b3e-8e00-eee8a19078ce@glegroupsg2000goo.googlegroups.com>
Date Wed, 1 Jun 2011 13:57:57 +1000
Subject Re: float("nan") in set or as key
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2354.1306900680.9059.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 82.94.164.166
X-Trace 1306900680 news.xs4all.nl 49044 [::ffff:82.94.164.166]:59466
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6784

Show key headers only | View raw


On Wed, Jun 1, 2011 at 1:30 PM, Carl Banks <pavlovevidence@gmail.com> wrote:
> I think you misunderstood what I was saying.
>
> It's not *possible* to represent a real number abstractly in any digital computer.  Python couldn't have an "abstract real number" type even it wanted to.

True, but why should the "non-integer number" type be floating point
rather than (say) rational? Actually, IEEE floating point could mostly
be implemented in a two-int rationals system (where the 'int' is
arbitrary precision, so it'd be Python 2's 'long' rather than its
'int'); in a sense, the mantissa is the numerator, and the scale
defines the denominator (which will always be a power of 2). Yes,
there are very good reasons for going with the current system. But are
those reasons part of the details of implementation, or are they part
of the definition of the data type?

> (Math aside: Real numbers are not countable, meaning they cannot be put into one-to-one correspondence with integers.  A digital computer can only represent countable things exactly, for obvious reasons; therefore, to model non-countable things like real numbers, one must use a countable approximation like floating-point.)

Right. Obviously a true 'real number' representation can't be done.
But there are multiple plausible approximations thereof (the best
being rationals).

Not asking for Python to be changed, just wondering why it's defined
by what looks like an implementation detail. It's like defining that a
'character' is an 8-bit number using the ASCII system, which then
becomes problematic with Unicode. (Ohai, C, didn't notice you standing
there.)

Chris Angelico

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


Thread

Re: float("nan") in set or as key Carl Banks <pavlovevidence@gmail.com> - 2011-05-31 20:30 -0700
  Re: float("nan") in set or as key Roy Smith <roy@panix.com> - 2011-05-31 23:43 -0400
    Re: float("nan") in set or as key Grant Edwards <invalid@invalid.invalid> - 2011-06-01 14:04 +0000
  Re: float("nan") in set or as key Chris Angelico <rosuav@gmail.com> - 2011-06-01 13:57 +1000
    Re: float("nan") in set or as key Ben Finney <ben+python@benfinney.id.au> - 2011-06-01 15:18 +1000
  Re: float("nan") in set or as key Jerry Hill <malaclypse2@gmail.com> - 2011-06-01 09:44 -0400
  Re: float("nan") in set or as key Chris Angelico <rosuav@gmail.com> - 2011-06-02 02:12 +1000

csiph-web