Folding constants for floats
Sven Panne
svenpanne at gmail.com
Tue Jan 14 08:03:34 UTC 2014
... and let's not forget about such fun stuff as IEEE's -0, e.g.:
1/(-1 * 0) => -Infinity
1/(0 + (-1 * 0)) => Infinity
If we take the standpoint that Haskell's Float and Double types
correspond to IEEE 754 floating point numbers, there is almost no
mathematical equivalence which holds, and consequently almost all
folding or other optimizations will be wrong. One can do all these
things behind a flag (trading IEEE compatibility for better code), but
this shouldn't be done by default IMHO.
More information about the ghc-devs
mailing list