Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for BigDecimal#/ #797

Merged
merged 1 commit into from Jun 17, 2013

Conversation

Projects
None yet
2 participants
@tychobrailleur
Copy link
Contributor

tychobrailleur commented Jun 10, 2013

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

@BanzaiMan

This comment has been minimized.

Copy link
Member

BanzaiMan commented Jun 17, 2013

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

Thanks!

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.

BanzaiMan added a commit that referenced this pull request Jun 17, 2013

@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
You can’t perform that action at this time.