On 18-Jul-2000, Keith Wansbrough <[EMAIL PROTECTED]> wrote:
> > IMHO GHC's documentation should clearly warn that programmers should
> > not depend on even basic stability and exactness of floating point
> > computations, and only stability is provided by -fstrictfp.
> 
> GHC is no different from any other compiler for any other language in 
> this respect.

There's a huge difference between languages like C, which have
unspecified and/or undefined behaviour lurking in every nook and
cranny, and pure functional languages like Haskell.  Haskell functions
are supposed to be referentially transparent mathematical functions:
for any given function in any given program, for any given inputs to that
function, you should get the same output from that function every time.

> Floating-point values are *not* the mathematical `real 
> numbers', and should not be treated as such.

Yes, but for any given Haskell program execution, the sum of any two
floating-point values should be the same every time you compute it.
In general it need not be the same as the sum of the equivalent real
numbers, because floating point numbers are subject to rounding,
overflow, etc., and of course it might vary from platform to platform,
or from compiler to compiler, or perhaps even from run to run;
but nevertheless, Haskell or any other language which aims to be
referentially transparent, for any given program execution the sum
should be the same each time in that program execution.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.

Reply via email to