Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '__future__': 0.09; 'oh,': 0.09; 'subject:skip:m 10': 0.09; 'python': 0.11; 'anyway': 0.11; 'thu,': 0.15; 'division,': 0.16; 'threw': 0.16; 'wrote:': 0.16; 'integer': 0.18; 'runs': 0.18; '2.x': 0.22; 'am,': 0.23; '2015': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'paul': 0.24; 'message-id:@mail.gmail.com': 0.28; 'fedora': 0.29; 'error.': 0.31; 'possibly': 0.32; 'problem': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'received:google.com': 0.34; 'to:addr:python- list': 0.35; 'but': 0.36; 'subject:: ': 0.37; 'test': 0.39; 'to:addr:python.org': 0.39; 'well.': 0.40; 'jul': 0.72; 'to:name:python': 0.84 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=acPjqw3/KNKLn5l++imhM7sHmYQsEPwooeX3KnIgs0c=; b=AVj7sbXi3YuCMzH//ffTytAb8Tmt3GHz14tABqTEBaJzT8mPxX8uYunOdtCSd7yiNt F4EIj26ni7tFHZfiRpm7e6XXFZ75aAwjEO82rys7erbRtvgSZFtZor1xvP4BiSgdRGlR 0l1fTldsJBIx/1CyJSV7xCOMzFpSki52GC9aXYt13lovJw/gutW+dYcjrrw0hYBI05H4 t62kZsyGONlHes4AIfLvqMcrNpG+KY9cFinMslvjLgPnzH3LwMazs05jL6sz1zMRiP7/ BZ9bSGaqo9rggaApzrJGTe3ZTWInNMBOhM8huMszIV2pha3fNqLwXq5jeYOhXd4/vIOk iPBA== X-Received: by 10.170.83.213 with SMTP id z204mr36851841ykz.63.1435851523214; Thu, 02 Jul 2015 08:38:43 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <87a8vepomp.fsf@nightsong.com> References: <55955048$0$1662$c3e8da3$5496439d@news.astraweb.com> <87a8vepomp.fsf@nightsong.com> From: Ian Kelly Date: Thu, 2 Jul 2015 09:38:03 -0600 Subject: Re: Bug in floating point multiplication To: Python Content-Type: text/plain; charset=UTF-8 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1435851526 news.xs4all.nl 2896 [2001:888:2000:d::a6]:39314 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:93437 On Thu, Jul 2, 2015 at 9:26 AM, Paul Rubin wrote: > Steven D'Aprano writes: >> x = 1 - 1/2**53 >> assert x == 0.9999999999999999 > > In Python 2.x I don't see how that assert can possibly succeed, since > x is the integer 1. But I tested it anyway on 2.7.5 under Fedora 19 > and it threw an assertion error. Oh, duh. That was the problem on my 2.7.6 test as well. I added from __future__ import division, and now it runs to completion.