-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Make BigDecimal::limit work for subtraction and division. Fix issue #1615 #4830
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -1040,7 +1035,9 @@ public IRubyObject op_quo(ThreadContext context, IRubyObject other) { | |||
int pow = len / 4; | |||
int precision = (pow + 1) * 4 * 2; | |||
|
|||
return divWithScale(context, val, precision); | |||
IRubyObject result = divWithScale(context, val, precision); | |||
if (result.getClass() == RubyBigDecimal.class) return ((RubyBigDecimal) result).setResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not an instanceof
check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paranoia that there might be some hidden RubyBigDecimal subclass with strange behaviour.
Nah, it can totally be changed to instanceof
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, if you get a chance please adjust - JRuby is quite in control of its sub-classes.
no need for paranoia 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I pushed a fix.
👍 from me too. I'll merge to master and 9.1. |
Actually looks like there are other changes to BigDecimal on master that would need to be merged to jruby-9.1 first, like the divWithScale method. I'll try to sort it out. |
No description provided.