Max Rabkin ha scritto:
[...]

Then we can define
    (/.) :: (Real a1, Real a2, Fractional a) => a1 -> a2 -> a
    x /. y = fromRational $ toRational x / toRational y
> [...]

(//) :: (Integral b, Real a, Real a1) => a -> a1 -> b
x // y = floor $ toRational x / toRational y

Hope that helps,
Max


Yes, thanks.

However there is still a *big* problem: it is inefficient.

Here is a Python version of the Chudnovsky algorithm [1] for computing Pi:
http://paste.pocoo.org/show/102800/

On my system it takes 10 seconds.

Here is an Haskell version:
http://paste.pocoo.org/show/102801/

On my system it takes 30 seconds.



Thanks   Manlio Perillo



[1] http://upload.wikimedia.org/math/6/6/8/6681cd21f3ca9bf13248a87d4202e06a.png


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to