Calculating the value of e

From Fōrmulæ wiki
Revision as of 20:34, 22 March 2019 by Admin (Talk | contribs) (Description (from Rosetta Code))

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page is the answer to the task Creating Calculating the value of e in the Rosetta Code.

Description (from Rosetta Code)


Calculate the value of e.

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

See details: Calculating the value of e

Option 1. Direct

In Fōrmulæ, the Euler's number calculation can be directly asked with the Math.Number and the Math.Constant.Euler expressions, with an arbitrary precision.


Option 2. Using series

It can also be calculated as a finite sum of the infinite series


Please note that by default, Fōrmulæ performs exact calculations, so it is necessary to show a decimal representation.

Option 3. Using a program

In the previous example, calculation of factorials repeats a lot of work (multiplications). In order to improve the performance, the program can be written.

The program stops when a specified precision is achieved.

The same program when the flowchart package visualization is selected. Click/tap to enlarge