Created
June 2, 2013 19:35
-
-
Save akoskovacs/5694632 to your computer and use it in GitHub Desktop.
Viéte Pi approximation algorithm in Haskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make_pi :: Int -> Double | |
make_pi n = product [2.0/(a x)|x <- [0..n]] where | |
a 0 = 1.0 | |
a 1 = sqrt 2 | |
a n = sqrt(2+(a (n-1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: make_pi 100