Fix for BigDecimal#/ #797

Merged
merged 1 commit into from Jun 17, 2013

Projects

None yet

2 participants

@tychobrailleur
Contributor

This fixes #644 and #648. See this #648 (comment) comment for discussion.

@BanzaiMan
Member

@tychobrailleur Could you rebase to the current master and squash these commits into one?

Thanks!

@tychobrailleur tychobrailleur Fix BigDecimal#/
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.
b5069f8
@BanzaiMan BanzaiMan merged commit 0447f28 into jruby:master Jun 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment