
Am Samstag 22 August 2009 11:34:51 schrieb Eugene Kirpichov:
2009/8/22 Roberto López
: If 4.0 / 2.0 was 1.9999999999999999999998, it would be ok?
I think yes.
I don't. Not for (+), (-), (*), (/). There I want "the representable number closest to the exact answer".
However, hardware can afford to do computations "as accurately as possible", whereas software like Haskell Prelude can't.
The real value of log10 1000 is 3 (3.0). It can be represented with accuracy and it should be.
Doing so would not be of much use and would impose a performance penalty required to achieve this accuracy.
+1 It is so rare that such functions have exactly representable results that it's absolutely not worth to check. Hence it is the programmer's obligation to test and adjust if it's moderately likely that such a case arises and it's important.