packages feed

egison-5.0.0: sample/pi.egi

--
-- This file has been auto-generated by egison-translator.
--

def approxPi (n: Integer) : Rational :=
  4 / (1 + foldr (\x r -> power x 2 / (x * 2 + 1 + r)) 0 (take n nats))

approxPi 1

approxPi 2

approxPi 3

approxPi 4

approxPi 5

approxPi 6

approxPi 7

approxPi 8

approxPi 9

approxPi 10

approxPi 20

approxPi 200

showDecimal 100 (approxPi 1)

showDecimal 100 (approxPi 2)

showDecimal 100 (approxPi 3)

showDecimal 100 (approxPi 4)

showDecimal 100 (approxPi 5)

showDecimal 100 (approxPi 6)

showDecimal 100 (approxPi 7)

showDecimal 100 (approxPi 8)

showDecimal 100 (approxPi 9)

showDecimal 100 (approxPi 10)

showDecimal 100 (approxPi 20)

showDecimal 100 (approxPi 200)

show (rtof (approxPi 200))