I am trying to make a simple code to get an aproximation for PI using haskell. However it seems the program predicts the result of the division is an Integer, even though the division is never exact (again, it is PI).... Or at least that is what I understand :P
Here is the code:
divpi :: Integer -> Double
divpi k = (((fatc (6*k)) * ((545140134*k) + 13591409))/((fatc (3*k)) * (pot (fatc k) 3) * (pot (-262537412640768000) k)))
fatc is factorial (fatc number) and pot is integer exponentiation (pot base exponent)
The error message:
ERROR file:.\haskel.hs:33 - Type error in explicitly typed binding
*** Term : divpi
*** Type : Integer -> Integer
*** Does not match : Integer -> Double
If necessary, here is the entire code