Euler's constant 0.5772...: Difference between revisions
m
Move Nim entry to correct location
(Adds a Nim implementation of Euler's Constant) |
Thundergnat (talk | contribs) m (Move Nim entry to correct location) |
||
Line 792:
0.5772156649015341
</pre>
=={{header|Julia}}==
Line 798 ⟶ 797:
<lang julia>display(MathConstants.γ) # γ = 0.5772156649015...
</lang>
=={{header|Nim}}==▼
<lang nim>import std/math▼
const n = 1e6▼
var result = 1.0▼
for i in 2..int(n):▼
result += 1/i▼
echo result - ln(n)▼
</lang>▼
{{out}}▼
<pre>▼
0.5772161649007153▼
</pre>▼
=={{header|PARI/GP}}==
Line 1,377 ⟶ 1,392:
<pre>
0.5772156649015328606065120900824024310421593359399235988057672348848677267776646709369470632917467495
▲</pre>
▲=={{header|Nim}}==
▲<lang nim>import std/math
▲const n = 1e6
▲var result = 1.0
▲for i in 2..int(n):
▲ result += 1/i
▲echo result - ln(n)
▲</lang>
▲{{out}}
▲<pre>
▲0.5772161649007153
</pre>
|