Calculating the value of e: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "{{Calculating the value of e}} Calculate the value of e. See details: [https://en.wikipedia.org/wiki/E_(mathematical_constant) Calculating the value of e] =={{header|Ring}}=...")
 
(Amended template for converting this to a draft task.)
Line 1: Line 1:
{{draft task}}
{{Calculating the value of e}}



Calculate the value of e. See details: [https://en.wikipedia.org/wiki/E_(mathematical_constant) Calculating the value of e]
Calculate the value of e. See details: [https://en.wikipedia.org/wiki/E_(mathematical_constant) Calculating the value of e]





=={{header|Ring}}==
=={{header|Ring}}==

Revision as of 10:06, 21 April 2018

Calculating the value of e is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.


Calculate the value of e. See details: Calculating the value of e



Ring

<lang ring>

  1. Project : Calculating the value of e
  2. Date  : 2018/04/21
  3. Author : Gal Zsolt [~ CalmoSoft ~]
  4. 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