Another question: Compile-time constant folding for Float/Double isThis must be totally wrong. There is no more justification to do constant folding
always done via Rational in GHC, so it is more exact than the runtime
computation.---------- Bar.hs --------------------------------
main :: IO ()
main = print (0.7480 - 0.0433 :: Float,
0.7480 - 0.0433 :: Double)
--------------------------------------------------
panne@jeanluc:~ > ghc Bar.hs && ./a.out
(0.70470005,0.7047)
panne@jeanluc:~ > ghc -O Bar.hs && ./a.out
(0.7047,0.7047)
--------------------------------------------------Is this legal?
in Rational than in, say, Int. Constant folding must be done at the same type as
the expression is at. It must also be done with the same FP representation as
the target machine. So doing e.g. IEEE FP manipulation is wrong if your target
is an old VAX (or a modern 390 :).
-- -- Lennart