[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Floating point inaccuracies
- From: David Kastrup <dak@...>
- Date: Tue, 30 Nov 2010 17:18:05 +0100
Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
>> On Tue, Nov 30, 2010 at 4:47 PM, Paul Hudson <phudson@pobox.com> wrote:
>> > Even more likely to trap the unwary, I'd have thought.
>>
>> Yes, such weird implementation details will only postpone the point
>> when someone _really_ needs to understand floating-point! The earlier
>> the better; when they taught us FORTRAN IV they hammered the
>> do-not-expect-floats-to-be-equal point home.
>
> YES!!!! Lots of very bright people have been working with floating
> points for a very long time. Learn with them before trying to "solve"
> those problems.
I want transitivity for my comparison operators.
a==b and b==c => a==c
a<=b and b<=c => a<=c
And of course I want exactly one of the following to hold for any
definite pair of numbers:
a<b, a>b, a==b
And I want a<=b to be the same as (a<b or a==b) and as not (a>b).
Anything else is madness. It's bad enough that floating point addition
and multiplication are not associative operators. We should not mess
with more dependable properties than avoidable.
--
David Kastrup