Calculating the value of e
Template:Calculating the value of e
Calculate the value of e. See details: Calculating the value of e
Ring
<lang ring>
- Project : Calculating the value of e
- Date : 2018/04/21
- Author : Gal Zsolt [~ CalmoSoft ~]
- Email : <calmosoft@gmail.com>
decimals(14)
for n = 1 to 100000
e = pow((1 + 1/n),n)
next see "Calculating the value of e with method #1:" + nl see "e = " + e + nl
e = 0 for n = 0 to 12
e = e + (1 / factorial(n))
next see "Calculating the value of e with method #2:" + nl see "e = " + e + nl
func factorial(n)
if n = 0 or n = 1 return 1 else return n * factorial(n-1) ok
</lang> Output:
Calculating the value of e with method #1: e = 2.71826823719230 Calculating the value of e with method #2: e = 2.71828182828617