Fix BigDecimal#round behavior with NAN and INFINITY #1808
JRuby's behavior of
Moreover, when we call
This area of code on this branch is a bit different from
Have a nice day.
When we call round without any argument on BigDecimal::NAN or BigDecimal::INFINITY, a FloatDomainError should be raised. Otherwise, the number shouldn't be altered. The problem is that JRuby defines these constants according to BigDecimal.ZERO so when we apply the rounding on it, it returns a float form of 0. Thus, we need to short-circuit that and return the constant itself.