Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:skip:m 10': 0.09; 'unexpected': 0.09; 'python': 0.11; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'uname': 0.16; 'tue': 0.18; '>>>': 0.20; '"",': 0.22; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'linux': 0.26; 'cest': 0.29; 'file': 0.34; 'to:addr:python- list': 0.35; 'subject:: ': 0.37; 'received:org': 0.38; 'to:addr:python.org': 0.39; 'more': 0.62; 'mar': 0.65; 'received:109': 0.75; 'becker': 0.84; 'smp': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robin Becker Subject: Re: Bug in floating point multiplication Date: Thu, 02 Jul 2015 16:29:40 +0100 References: <55955048$0$1662$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 109.174.168.73 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <55955048$0$1662$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1435850983 news.xs4all.nl 2947 [2001:888:2000:d::a6]:52798 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3446 X-Received-Body-CRC: 680522902 Xref: csiph.com comp.lang.python:93434 $ uname -a Linux everest 4.0.6-1-ARCH #1 SMP PREEMPT Tue Jun 23 14:40:31 CEST 2015 i686 GNU/Linux robin@everest:~ $ python2 Python 2.7.10 (default, May 26 2015, 04:28:58) [GCC 5.1.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> x = 1.0 - 1.0/2**53 >>> assert x == 0.9999999999999999 >>> for i in range(1, 1000000): ... if int(i*x) == i: ... print(i); break ... 2049 >>> robin@everest:~ $ python Python 3.4.3 (default, Mar 26 2015, 07:36:01) [GCC 4.9.2 20150304 (prerelease)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> KeyboardInterrupt >>> x = 1 - 1/2**53 >>> assert x == 0.9999999999999999 >>> for i in range(1, 1000000): File "", line 1 for i in range(1, 1000000): ^ IndentationError: unexpected indent >>> for i in range(1, 1000000): ... if int(i*x) == i: ... print(i); break ... 2049 >>> robin@everest:~/devel/filps -- Robin Becker