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

Joao S. O. Bueno jsbueno at python.org.br
Wed Jan 21 13:35:18 CET 2015


On 21 January 2015 at 10:29, Joao S. O. Bueno <jsbueno at python.org.br> wrote:
> On 21 January 2015 at 09:59, Steven D'Aprano <steve at pearwood.info> wrote:
>> On Wed, Jan 21, 2015 at 09:27:39AM -0200, Joao S. O. Bueno wrote:
...
>>
>> (2) Fuzzy equality means that there are situations where:
>>
>>     a == b and b == c
>>
>>     but
>>
>>     a != c
>>
>> The language APL tried to turn this into a feature:
>>
>>     The intransitivity of [tolerant] equality is well known in practical
>>     situations and can be easily demonstrated by sawing several pieces
>>     of wood of equal length. In one case, use the first piece to measure
>>     subsequent lengths; in the second case, use the last piece cut to
>>     measure the next. Compare the lengths of the two final pieces.
>>     — Richard Lathwell, APL Comparison Tolerance, APL76, 1976
>

It just hit me that while this intransivity is strange, mathematically
speaking, it
_is_ indeed what happens in  "the real world" when we are dealing with
measurements
- this wood piece example being more than enough to show it.
Since the whole discussion about floating point closeness is to ease out
algorithms  that need to be concerned on  how numbers behave "out there", maybe
this behavior is not that far off, neither that undesirable at all.

>>
>> --
>> Steve
>> ______________________


More information about the Python-ideas mailing list