Euler's constant 0.5772...: Difference between revisions

m (→‎{{header|Raku}}: simplify)
Line 761:
gmp_printf (!"time: %.7f s\n", TIMER - tim)
end</lang>
 
 
=={{header|jq}}==
'''Translated from [[#C|C]] (Bailey, 1988)'''
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
 
<lang jq># Bailey, 1988
def bailey($n; $eps):
pow(2; $n) as $n2
| {a :1, b: 0, h: 1, r: 1, k: 1}
| until( (.b - .a)|fabs <= $eps;
.k += 1
| .r *= ($n2 / .k)
| .h += (1.0 / .k)
| .b = .a
| .a += (.r * .h) )
| (.a * $n2 / ($n2|exp) ) - ($n * (2|log)) ;</lang>
{{out}}
<pre>
bailey(5; 1E-6)
0.5772156649015341
</pre>
 
 
2,458

edits