A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-March/098510.html below:

[Python-Dev] Decimal <-> float comparisons in py3k.

[Python-Dev] Decimal <-> float comparisons in py3k. [Python-Dev] Decimal <-> float comparisons in py3k.Glenn Linderman v+python at g.nevcal.com
Thu Mar 18 21:35:55 CET 2010
On 3/18/2010 12:45 PM, Robert Kern wrote:
> On 2010-03-18 13:27 PM, Glenn Linderman wrote:
>
>> As any non-naïve float user is aware, the proper form of float
>> comparisons is not to use < or > or == or !=, but rather, instead of
>> using < (to follow along with your example), one should use:
>>
>> Decimal('1.1') - 2.2 < epsilon
>
> Not at all. This is quite incorrect for most use cases. Fuzzy 
> comparisons are sometimes useful for equality testing, but almost 
> never for ordering.
>

I wondered if anyone would catch me on that!  I did it mostly to keep 
the same example going, but partly to see if there were any real 
floating point experts in the discussion!  You'll have noted my 
reference was to using the technique for equality.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4