fork/numbat

git clone https://git.julia.blue/fork/numbat

David PeterAdd euler approximation exampleaf0f856

v1.7.0
188 B8 linesraw
1# Compute the number e from 1/0! + 1/1! + 1/2! + 1/3! + …
2
3fn approx_e(n: Scalar) -> Scalar =
4  if n == 0
5    then 1
6    else 1 / n! + approx_e(n - 1)
7
8assert_eq(approx_e(20), e, 1e-10)