Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.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.168 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.68; '*S*': 0.01; '(except': 0.07; 'implies': 0.16; 'rounding': 0.16; 'saying.': 0.16; 'special.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '(or': 0.24; 'compare': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'steven': 0.31; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'equal': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'error.': 0.37; 'two': 0.37; 'received:209': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'itself': 0.39; 'to:addr:python.org': 0.39; 'even': 0.60; 'numbers': 0.61; 'more': 0.64; 'different': 0.65; 'special': 0.74; '5.4': 0.84; 'calculations': 0.84; 'rusi': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=wH0SZHqknGNX/w8DqKVrLpBqGtnd3v4RlGO5gNQZToc=; b=0hOuk7vTTgwMgAWuX0wXX4UEbKb7Hnc0UozrAxgT/PqBCCxyp9UEz82ILrS7Pc7I9g CUWNadCkwZoqh6bqv7xivmXlv2BiTFXy45IwRvT65zFPiH/P6qUggHg2qyV3QgAyqPRI SKJfrvYPJLnzXRLccym/3tOOMuevAj/jxrK7eUgetwWhUfoam9vXPkN12CgCz26U8fIW dHHm0QXRW4LxcmyMYNG/jJI2isI7oQ96aedAotC8nkT6RmRtZTkafBQyA6uFXHANxSNX d0ug4WJBkrx+Cc34dJpuPG5CCxDGyqj1SaFhI443ozP7q3mAeX+pY1biP7IA9beLhuD5 l2tA== X-Received: by 10.66.144.98 with SMTP id sl2mr4347995pab.92.1369846287613; Wed, 29 May 2013 09:51:27 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <48519aa0-d0cd-4ffc-a2f5-2107465321d8@qn4g2000pbc.googlegroups.com> References: <5f101d70-e51f-4531-9153-c92ee2486fd9@googlegroups.com> <51a1fc7b$0$30002$c3e8da3$5496439d@news.astraweb.com> <2abf4e9c-8c3b-4e2f-80c9-50c1f1d75c9d@googlegroups.com> <51a4b5a1$0$29966$c3e8da3$5496439d@news.astraweb.com> <04b90c02-833a-4bad-88ad-ab71178b8f79@googlegroups.com> <48519aa0-d0cd-4ffc-a2f5-2107465321d8@qn4g2000pbc.googlegroups.com> From: Ian Kelly Date: Wed, 29 May 2013 10:50:47 -0600 Subject: Re: Short-circuit Logic To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369847746 news.xs4all.nl 15954 [2001:888:2000:d::a6]:44772 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46394 On Wed, May 29, 2013 at 8:33 AM, rusi wrote: > 0.0 == 0.0 implies 5.4 == 5.4 > is not a true statement is what (I think) Steven is saying. > 0 (or if you prefer 0.0) is special and is treated specially. It has nothing to do with 0 being special. A floating point number will always equal itself (except for nan, which is even more special), and in particular 5.4 == 5.4. But if you have two different calculations that produce 0, or two different calculations that produce 5.4, you might actually get two different numbers that approximate 0 or 5.4 thanks to rounding error. If you then compare those two ever-so-slightly different numbers, you will find them unequal.