David Roundy wrote:

I'm rather curious (if you're sill interested) how this'll be affected by
the removal of the division from the inner loop. e.g.

    go :: Double -> Double -> Int -> IO ()
    go !x !y !i
        | i == 1000000000 = printf "%.6f\n" (x+y)
        | otherwise       = go (x*y*(1.0/3)) (x*9) (i+1)


    for (; i<1000000000; i++) {
        x = x*y*(1.0/3.0);
        y = x*9.0;
    }

GCC will do the transformation itself if you use -ffast-math. It requires the flag as the results aren't exactly numerically equivalent.

        <b
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to