WordPtr,IntPtr,IntMax,WordMax
Ben Rudiak-Gould
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Thu May 11 19:34:45 EDT 2006
Simon Marlow wrote:
> I suppose you might argue that "extra precision is always good".
Well... I'm having a hard time thinking of a situation where it isn't. I
realize that people want reproducibility, I'm just not convinced that they
should. The situations where optimization flags make a significant
difference in the result are situations where the original result wasn't
trustworthy to begin with. Reproducible rounding gives you a false sense of
security in those cases, and doesn't make a difference otherwise. If you
know IEEE 754 inside out, and IEEE double-precision is exactly what you
want, then it's nice if your programming language can cater to that, but
along those lines it'd be nice if Haskell supported rounding modes, trap
handlers, and so on.
I suppose this problem could be solved the way the analogous Int problem is
solved, with a machine-precision Float and portable/reproducible Float32 and
Float64.
The x87 isn't the only FPU with this problem. The PowerPC has a fused
(double*double)+double operation that the optimizer can't use if you need
reproducibility, because it doesn't round the intermediate product.
> LongDouble would be fine, but storing intermediate Doubles in 80 bits is
> bad.
The x87 registers are actually 82 bits wide, so even using LongDouble
doesn't guarantee reproducibility. Maybe there needs to be a Float80 also.
(Available only on x86, presumably.)
-- Ben
More information about the Glasgow-haskell-users
mailing list