Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'python.': 0.02; 'smallest': 0.07; 'integers': 0.09; 'logic': 0.09; 'wrote': 0.14; 'distinct': 0.16; 'relevance': 0.16; 'zero.': 0.16; 'meant': 0.20; '8bit%:5': 0.22; 'to:name:python-list@python.org': 0.22; 'comparing': 0.24; 'received:65.55.116': 0.24; 'url:02': 0.24; 'header:In-Reply-To:1': 0.27; 'skip:- 40': 0.29; '[1]': 0.29; 'equality': 0.31; 'steven': 0.31; 'entirely': 0.33; 'date:': 0.34; 'problem.': 0.35; 'test': 0.35; 'but': 0.35; 'skip:4 10': 0.37; 'to:addr:python-list': 0.38; 'subject:': 0.39; 'url:2012': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'discuss': 0.62; 'email addr:gmail.com': 0.63; 're:': 0.63; 'such': 0.63; 'url:wordpress': 0.78; '2013': 0.98 X-TMN: [2Ud40Tq/8ED3JpFjfn94wya9r3se8i98] X-Originating-Email: [carlosnepomuceno@outlook.com] From: Carlos Nepomuceno To: "python-list@python.org" Subject: RE: Short-circuit Logic Date: Tue, 28 May 2013 12:32:20 +0300 Importance: Normal In-Reply-To: <48a99056-fa56-4352-b8b4-f52d3467ac96@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>, , <48a99056-fa56-4352-b8b4-f52d3467ac96@googlegroups.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 28 May 2013 09:32:20.0812 (UTC) FILETIME=[409D50C0:01CE5B86] 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369733548 news.xs4all.nl 15967 [2001:888:2000:d::a6]:57981 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46269 ----------------------------------------=0A= > Date: Tue=2C 28 May 2013 01:39:09 -0700=0A= > Subject: Re: Short-circuit Logic=0A= > From: abdulshafy@gmail.com=0A= [...]=0A= >> What Steven wrote is entirely correct: sys.float_info.epsilon is the=0A= >>=0A= >> smallest value x such that 1.0 and 1.0+x have distinct floating-point=0A= >>=0A= >> representations. It has no relevance for comparing to zero.=0A= >=0A= > He just said that the way to test for zero equality is x =3D=3D 0=2C and = I meant that this is true for integers but not necessarily for floats. And = that's not specific to Python.=0A= =0A= =0A= Have you read [1]? There's a section "Infernal Zero" that discuss this prob= lem. I think it's very interesting to know! =3B)=0A= =0A= Just my 49.99999999999998=A2! lol=0A= =0A= =0A= [1] http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-nu= mbers-2012-edition/ =