Euler's constant 0.5772...: Difference between revisions
Content added Content deleted
(add RPL) |
(Initial FutureBasic task solution added) |
||
Line 949: | Line 949: | ||
Elapsed Time: 4.716 Sec. |
Elapsed Time: 4.716 Sec. |
||
</pre> |
</pre> |
||
=={{header|FutureBasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
void local fn Euler |
|||
long n = 10000000, k |
|||
double a, h = 1.0 |
|||
for k = 2 to n |
|||
h += 1 / k |
|||
next |
|||
a = log( n + 0.5 + 1 / ( 24 * n ) ) |
|||
printf @"From the definition, err. 3e-10" |
|||
printf @"Hn %.15f", h |
|||
printf @"gamma %.15f", h - a |
|||
printf @"k = %ld\n", n |
|||
printf @"C %.15f", 0.5772156649015328 |
|||
end fn |
|||
CFTimeInterval t |
|||
t = fn CACurrentMediaTime |
|||
fn Euler |
|||
printf @"\vCompute time: %.3f ms",(fn CACurrentMediaTime-t)*1000 |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
{{output}} |
|||
<pre> |
|||
From the definition, err. 3e-10 |
|||
Hn 16.695311365857272 |
|||
gamma 0.577215664898954 |
|||
k = 10000000 |
|||
C 0.577215664901533 |
|||
Compute time: 67.300 ms |
|||
</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |