Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
BigMath.log(Rational,...) produces garbage digits within the requested precision #4158
JRuby 188.8.131.52 on OpenJDK 1.8.0_101 on x86-64
MRI seems to perform the division of the numerator with the denominator with the requested precision (50 decimal digits in the example), and then it performs the logarithm with the requested precision.
JRuby seems to perform the division only with double precision (about 14 decimal digits, which is far lower than the requested precision), and then it performs the logarithm with the requested precision. If this is the case, then JRuby should not call ".to_f", but ".to_d(precision)" on the argument to BigDecimal.log.