
Hi,
On 28 May 2010 01:22, Pierre-Etienne Meunier
Then, examining the core (with of course -O3 on)
FYI, -O3 is the same as -O2.
revealed things like :
(GHC.Prim.*## (GHC.Prim.-## 1.0 (GHC.Prim.**## 2.0 -53.0)) (GHC.Prim.**## 2.0 1024.0))
or
case GHC.Prim.<## x_aB9 (GHC.Prim.**## 2.0 -1021.0) of _ {...
GHC does constant-fold many operations on floats/doubles at the Core level (see PrelRules.lhs) but there is no RULE for **. Perhaps there should be.
Then I wondered if this was really the last stage of GHC's optimizations,
I eyeballed the C-- code generator and it looks like that doesn't constant-fold ** either.
Any clue about how to do it ?
I think that rewriting your code is the only thing you can do. Please also submit a bug to the tracker and I'm sure that the right RULEs will get added soon. Cheers, Max