Task

Calculate the value of   e.



(e   is also known as   Euler's number   and   Napier's constant.)



See details: Calculating the value of e

%e0 %e %n %fact %v
 
0 !e0 2 !e 0 !n 1 !fact
1e-15 !v
 
:printOp swap print print nl ;
:test $e $e0 - abs $v >= ;
 
[$e !e0
$n 1 + !n
2 $n * 2 $n * 1 + * $fact * !fact
2 $n * 2 + $fact / $e + !e]
[test]    
while
 
%rE 
2.718281828459045 !rE
 
"Computed e = " $e tostr printOp
"Real e = " $rE tostr printOp
"Error = " $rE $e sub printOp
"Number of iterations = " $n printOp
 
" " input