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: 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: References: Date: Wed, 1 Jun 2011 13:57:57 +1000 Subject: Re: float("nan") in set or as key From: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Wed, Jun 1, 2011 at 1:30 PM, Carl Banks wrote= : > I think you misunderstood what I was saying. > > It's not *possible* to represent a real number abstractly in any digital = computer. =A0Python couldn't have an "abstract real number" type even it wa= nted 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 i= nto one-to-one correspondence with integers. =A0A digital computer can only= represent countable things exactly, for obvious reasons; therefore, to mod= el non-countable things like real numbers, one must use a countable approxi= mation 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