[Haskell-cafe] Re: Is logBase right?

Daniel Fischer daniel.is.fischer at web.de
Sat Aug 22 10:14:03 EDT 2009

Am Samstag 22 August 2009 11:34:51 schrieb Eugene Kirpichov:
> 2009/8/22 Roberto López <plastermoso at hotmail.com>:
> > 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.

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.

More information about the Haskell-Cafe mailing list