📅  最后修改于: 2022-03-11 14:57:02.849000             🧑  作者: Mango
fac :: Int -> Int
fac n = if (n == 0) then 1 else n * fac (n-1)
cos :: Double -> Double
cos x = sum [cos| k <- [0..],
let cos = (-1) * (x^(2*k) / fromIntegral (fac (2*k))) ,
abs (cos) > 0.001]