When dividing BigDecimal by a Float, the Float is converted to Rational “for higher precision,” and then divides the numerator by the denominator. However, when doing that division, `div19` was being used which does a `floor` on the returned float. This commit replaces the call to `div19` with `op_div`. This commit also addresses issues with return type of the result, which changes from version to version in Ruby. See https://github.com/rubyspec/rubyspec/pull/220 for tests. Use java.math.BigDecimal to compute rational and float value. Make test applicable for 1.9/2.0 only. Code cleanup. A bit of housekeeping, adding whitespaces after commas, and around equals. Return Float when BigDecimal is divided by Float in 1.9. Recent versions of 1.9.3 now exhibit the same behaviour as 2.0.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments.