Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: float("nan") in set or as key Date: Wed, 1 Jun 2011 14:03:14 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 42 Message-ID: References: NNTP-Posting-Host: dsl.comtrol.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reader1.panix.com 1306936994 22799 64.122.56.22 (1 Jun 2011 14:03:14 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 1 Jun 2011 14:03:14 +0000 (UTC) User-Agent: slrn/pre0.9.9-102 (Linux) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6793 On 2011-06-01, Chris Angelico wrote: > On Wed, Jun 1, 2011 at 12:59 PM, Carl Banks 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. ?Unlike the case with integers, there is no way that I know of to represent an abstract real number on a digital computer. > > 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, But, "real numbers" and "IEEE float" are so different that I don't think that it would be a wise decision for people to pretend they're working with real numbers when in fact they are working with IEEE floats. > for instance, how Python 3 has dispensed with 'int' vs 'long' and > just made a single 'int' type that can hold any integer. Those concepts are much closer than "real numbers" and "IEEE floats". > 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 certainly hope so. I depend on things like propogation of non-signalling nans, the behavior of infinities, etc. > I'm glad I don't often need floating point numbers. They can be so > annoying! They can be -- especially if one pretends one is working with real numbers instead of fixed-length binary floating point numbers. Like any tool, floating point has to be used properly. Screwdrivers make very annoying hammers. -- Grant Edwards grant.b.edwards Yow! How's it going in at those MODULAR LOVE UNITS?? gmail.com