Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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; 'instance,': 0.05; 'python': 0.08; 'pm,': 0.10; 'wrote:': 0.14; "'int'": 0.16; "'long'": 0.16; '12:59': 0.16; 'angelico': 0.16; 'integer.': 0.16; 'integers.': 0.16; 'message- id:@glegroupsg2000goo.googlegroups.com': 0.16; 'nan': 0.16; 'okay,': 0.16; 'reply-to:addr:comp.lang.python': 0.16; 'saying.': 0.16; 'simulate': 0.16; 'subject:key': 0.16; 'subject:set': 0.16; 'to:addr:comp.lang.python': 0.16; 'value",': 0.16; 'question.': 0.16; 'cc:addr:python-list': 0.17; 'meant': 0.18; 'header:In- Reply-To:1': 0.21; 'seems': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'sunday,': 0.23; "what's": 0.23; "doesn't": 0.25; 'format,': 0.25; '(and': 0.25; 'received:209.85.161': 0.26; 'saying': 0.26; 'cc:addr:python.org': 0.30; 'carl': 0.30; 'define': 0.31; 'represents': 0.32; 'does': 0.33; 'things': 0.33; 'chris': 0.34; 'normally': 0.34; 'there': 0.35; 'header:User- Agent:1': 0.35; 'hold': 0.36; 'uses': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'floating': 0.37; 'note,': 0.37; 'case': 0.37; 'model': 0.37; 'pretty': 0.37; 'put': 0.37; 'think': 0.38; 'but': 0.38; 'data': 0.38; 'hardware': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'received:209': 0.39; 'everyone': 0.40; "couldn't": 0.40; 'meaning': 0.40; 'therefore,': 0.63; 'to:addr:googlegroups.com': 0.63; '31,': 0.65; 'header:Reply- To:1': 0.72; 'reply-to:no real name:2**0': 0.72; 'reply- to:addr:googlegroups.com': 0.73 Newsgroups: comp.lang.python Date: Tue, 31 May 2011 20:30:30 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=74.37.53.32; posting-account=XFEWnwoAAADNO10m3Wcmq_SWdmyZuXff User-Agent: G2/1.0 X-Google-Web-Client: true MIME-Version: 1.0 Subject: Re: float("nan") in set or as key From: Carl Banks To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: comp.lang.python@googlegroups.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 38 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306899038 news.xs4all.nl 49182 [::ffff:82.94.164.166]:42421 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6780 On Tuesday, May 31, 2011 8:05:43 PM UTC-7, Chris Angelico wrote: > On Wed, Jun 1, 2011 at 12:59 PM, Carl Banks=20 > wrote: > > On Sunday, May 29, 2011 7:53:59 PM UTC-7, Chris Angelico wrote: > >> Okay, here's a question. The Python 'float' value - is it meant to be > >> "a Python representation of an IEEE double-precision floating point > >> value", or "a Python representation of a real number"? > > > > The former. =A0Unlike the case with integers, there is no way that I kn= ow of to represent an abstract real number on a digital computer. >=20 > This seems peculiar. Normally Python seeks to define its data types in > the abstract and then leave the concrete up to the various > implementations - note, for instance, how Python 3 has dispensed with > 'int' vs 'long' and just made a single 'int' type that can hold any > integer. Does this mean that an implementation of Python on hardware > that has some other type of floating point must simulate IEEE > double-precision in all its nuances? I think you misunderstood what I was saying. It's not *possible* to represent a real number abstractly in any digital co= mputer. Python couldn't have an "abstract real number" type even it wanted= to. (Math aside: Real numbers are not countable, meaning they cannot be put int= o one-to-one correspondence with integers. A digital computer can only rep= resent countable things exactly, for obvious reasons; therefore, to model n= on-countable things like real numbers, one must use a countable approximati= on like floating-point.) You might be able to get away with saying float() merely represents an "abs= tract floating-point number with provisions for nan and inf", but pretty mu= ch everyone uses IEEE format, so what's the point? And no it doesn't mean = Python has to support every nuance (and it doesn't). Carl Banks