Path: csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: python 3.44 float addition bug? Date: Tue, 24 Jun 2014 17:30:41 +1200 Lines: 14 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net TbZ4YYkdL4zymGnrh66vtQ5g2ohyiTty8oM4mpaXqZKhU7iM6i Cancel-Lock: sha1:gWwLAZiRSxoJU7jN7sjF9tInBMI= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:73530 buck wrote: > What's the recommended way to do this now? > >>>>format(.01 + .01 + .01 + .01 + .01 + .01, 'g') == format(.06, 'g') There's no recommended way. What you're asking for can't be done. Whatever trick you come up with, there will be cases where it doesn't work. Why do you think you want to compare floats for equality? The best thing to do will depend on the answer to that. -- Greg