Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'wed,': 0.03; 'default,': 0.07; 'numeric': 0.07; 'python': 0.08; 'integers': 0.09; 'received :mail-bw0-f46.google.com': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'different,': 0.16; 'floats': 0.16; 'head,': 0.16; 'received:209.85.214.46': 0.16; 'situations,': 0.16; 'subject:key': 0.16; 'subject:set': 0.16; 'url:html)': 0.16; 'have:': 0.19; 'header:In-Reply-To:1': 0.21; 'fixed': 0.27; 'message-id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; 'true,': 0.29; 'do.': 0.30; '(both': 0.30; 'carl': 0.30; 'now)': 0.30; 'url:library': 0.31; 'seem': 0.32; 'usually': 0.32; 'to:addr :python-list': 0.33; 'rather': 0.34; 'received:google.com': 0.37; 'something': 0.37; 'received:209.85': 0.37; 'floating': 0.37; 'url:docs': 0.37; 'pretty': 0.37; 'url:python': 0.38; 'url:org': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'best': 0.60; 'plus': 0.65; 'ships': 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; bh=B8T/BPkrv3iQk0fwG6gZKeRxR9tnD5Cdc/8So4pVST8=; b=hEaO4GxvdhA67XVRaM3T59l0GyDJ12vvoVEC0vpXL1t0mkXmNsG5DCJbJ+a+krJbt+ 9IjftLji0dkT+v5MROih0z1X19CEjHpI4JfJbYwYPeG+RJ6mua4e/3lip7yZzPMJGDa0 m79yrTFLUzQ4TMwbt1xRPK7DhWAj0p7e8BhgQ= 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; b=v6QrCuG4wNOJkzT9H9A0ISr2JRDzGR4BBiGaWmXDmMv63Pia9BdvpVV+gw0YwwkcyZ jgNQJLv/HIdmw3aZgKf1+NL/3OPxBqRWuMJLPjZYlvz99jJtp9b+F4jWNqoP+qNjFaiF ZYlmf7vjTzMvvUZhleAEmAztdqU7oR9xOpang= MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 1 Jun 2011 09:44:36 -0400 Subject: Re: float("nan") in set or as key From: Jerry Hill To: python-list@python.org Content-Type: text/plain; charset=UTF-8 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: 25 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306935879 news.xs4all.nl 49046 [::ffff:82.94.164.166]:54244 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6792 > On Wed, Jun 1, 2011 at 1:30 PM, Carl Banks wrote: > True, but why should the "non-integer number" type be floating point > rather than (say) rational? You seem to be implying that python only provides a single non-integer numeric type. That's not true. Python ships with a bunch of different numeric types, including a rational type. Off the top of my head, we have: IEEE floating point numbers (http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex) Rationals (http://docs.python.org/library/fractions.html) Base-10 fixed and floating point numbers (http://docs.python.org/library/decimal.html) Complex numbers (http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex plus http://docs.python.org/library/cmath.html) Integers (both ints and longs, which are pretty well unified by now) Floats have far and away the best performance in most common situations, so they end up being the default, but if you want to use something different, it's usually not hard to do. -- Jerry