[Shootout-list] takfp for ghc
Greg Buchholz
sleepingsquirrel@member.fsf.org
Sun, 12 Dec 2004 17:13:42 -0800 (PST)
--0-1955525075-1102900422=:66832
Content-Type: text/plain; charset=us-ascii
Content-Id:
Content-Disposition: inline
Attached is a version of the "takfp" benchmark for GHC.
Greg Buchholz
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
--0-1955525075-1102900422=:66832
Content-Type: text/x-haskell; name="takfp.hs"
Content-Description: takfp.hs
Content-Disposition: inline; filename="takfp.hs"
-- GHC version of floating point Tak function
-- compile with ghc -O2 -o takfp takfp.hs
-- Greg Buchholz
import System(getArgs)
main = do [num] <- getArgs
let n = read num
putStrLn $ show $ tak (3*n) (2*n) n
tak :: Double -> Double -> Double -> Double
tak x y z | y>=x = z
| otherwise = tak (tak (x-1) y z) (tak (y-1) z x) (tak (z-1) x y)
--0-1955525075-1102900422=:66832--