Calculating the value of e: Difference between revisions
→{{header|langur}}
(→{{header|UNIX Shell}}: style tweaks) |
Langurmonkey (talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 2,106:
[[File:Fōrmulæ - Calculating the value of e 01.png]]
[[File:Fōrmulæ - Calculating the value of e
'''Solution 2.''' Using series
Line 2,112:
[[File:Fōrmulæ - Calculating the value of e 03.png]]
[[File:Fōrmulæ - Calculating the value of e
'''Solution 3.''' Using a program
Line 2,118:
[[File:Fōrmulæ - Calculating the value of e 05.png]]
[[File:Fōrmulæ - Calculating the value of e
=={{header|Go}}==
Line 2,728:
for .fact, .n = 1, 2 ; ; .n += 1 {
val .e0 = .e
.fact
.e += 1 / .fact
if abs(.e - .e0) < .epsilon: break
Line 2,744:
e = 2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746
</pre>
=={{header|Lua}}==
<syntaxhighlight lang="lua">EPSILON = 1.0e-15;
Line 4,219 ⟶ 4,220:
# least 31 bits available, which is sufficient to store (e - 1) * 10^9
declare -ir one=
declare -i e n rfct=one
while ((
do e+=rfct
done
|