"Wilhelm B. Kloke" wrote:
> IMHO you are not right in this. See W. Kahan on the ridiculous Java
> restriction in FP reproducibility.
We are getting into deep waters here but I think I _am_ right in this case.
Kahan's point (I presume you are referring to his excellent (online)
paper "How JAVA's Floating-Point Hurts Everyone Everywhere") is that
expecting exact reproducibility of floating point is unrealistic in the
face of pressures to squeeze the last clock-cycle out of matrix computations,
Pentium processors, etc, on modern computers.  But with respect Glasgow Haskell
isn't really playing in this ball-game at all.  I suspect the cost in
code performance of guaranteeing reproducibility for a fixed machine
would be very slight.  Constant folding only affects the compiler, and could
be disallowed for crosscompilation (which I believe is only used for
bootstrapping).  The other issue (a problem with Java)
is that Pentiums store floats in the processor in extra non-IEEE precision
which means that if you want to guarantee intermediate calculations behaving
sensibly you have to put in an extra operation, such as writing the number
to memory.  This is done anyway for GHC Double/Float which are boxed anyway.
So I think the cost of making the simple arithmetic functions pure is
pretty slight compared to the other implicit costs in GHC, and a price
well worth paying for removing a few elephant traps from the floating point
undergrowth. [ That's enough metaphors.  Ed ]

Reply via email to