To generate a high-precision value for Ramanujan's constant, code is borrowed from three other Rosettacode tasks (with some modifications) for performing calculations of the value of Ļ,
Euler's number, and integer roots. Additional custom routines for exponentiation are used to ensure all computations are done with rationals, specifically FatRats (rational numbers stored with arbitrary size numerator and denominator). The module Rat::Precise makes it simple to display these to a configurable precision.
Ramanujan's constant to 32 decimal places:
Actual: 262537412640768743.99999999999925007259719818568888
Calculated: 262537412640768743.99999999999925007259719818568888
Heegner numbers yielding 'almost' integers
Int 885480
Heegner 885479.777680154319498
Difference 0.222319845680502
Int 884736744
Heegner 884736743.999777466034907
Difference 0.000222533965093
Int 147197952744
Heegner 147197952743.999998662454225
Difference 0.000001337545775
Int 262537412640768744
Heegner 262537412640768743.999999999999250
Difference 0.000000000000750
Continued fractions
Ramanujan's constant can also be generated to an arbitrary precision using standard continued fraction formulas for each component of the š**(Ļ*ā163) expression. Substantially slower than the first method.