Ramanujan's constant: Difference between revisions

Content added Content deleted
(→‎{{header|Ruby}}: Added Ruby)
Line 688: Line 688:
</pre>
</pre>


=={{header|Ruby}}==
<lang ruby>require "bigdecimal/math"
include BigMath

e, pi = E(200), PI(200)
[19, 43, 67, 163].each do |x|
puts "#{x}: #{(e ** (pi * BigMath.sqrt(BigDecimal(x), 200))).round(100).to_s("F")}"
end
</lang>
{{out}}
<pre>19: 885479.7776801543194975378934817196268207142865018553571526577110128809842286637202423189990118182067775711
43: 884736743.9997774660349066619374620785853768473991271391609175146278344881148747592189635643106023717101372606
67: 147197952743.999998662454224506829261312578628508183312503816712633371282105122950998831523502041379242353370629
163: 262537412640768743.9999999999992500725971981856888793538563373369908627075374103782106479101186073129511813461860645042
</pre>
=={{header|Sidef}}==
=={{header|Sidef}}==
<lang ruby>func ramanujan_const(x, decimals=32) {
<lang ruby>func ramanujan_const(x, decimals=32) {