# [Python-ideas] Floating point "closeness" Proposal Outline

Andrew Barnert abarnert at yahoo.com
Thu Jan 22 00:41:42 CET 2015

```On Jan 21, 2015, at 13:36, Nathaniel Smith <njs at pobox.com> wrote:

> On Wed, Jan 21, 2015 at 11:27 AM, Joao S. O. Bueno
> <jsbueno at python.org.br> wrote:
>> 1)  Implement a Number class that behaves as a float number, and does
>> the fuzzy comparisons automatically.
>>
>> Justificative: in a whole lot of code, having a "casted"
>> FuzzyFloat(mynumber) to be able to be compared to others with "==" and "<="
>> would be much more readable than the Javaesque
>>
>> " if is_close(my_number, other) or my_number < other: "
>> (against:
>> "if FuzzyFloat(my_number) <= other :"
>> , or simply
>
> I'm sure this has come up somewhere, but I have to say that I've never
> in my life seen a situation where an approximate <= was the correct
> solution to a problem. I've seen lots of exact <= (which you just
> assume is interchangeable with <) and approximate ==, but never
> approximate <=.

Well, when both values are approximate, you can use interval <= to mean "possibly <" (or "not definitely >", which is more often the way you'd write it).

But of course this isn't interval <=, it's approximate vs. assumed-to-be-exact, so this suggestion seems at best useless and at worst an attractive nuisance for people who want interval math but don't realize it.

```