-
Notifications
You must be signed in to change notification settings - Fork 186
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
Some kind of integer / float bounds issue; differing behavior from historical ruby up to HEAD and jruby #2631
Comments
Possibly related: #2184 |
@eregon I suspect we are missing some integer to float division implementation:
|
Good find, yeah those numbers are huge so the usual technique of converting to double first won't work here, it'll just become inf/inf->NaN:
The gcd stuff wouldn't help this case because Rational already ensures the gcd is 1. I think the logic in CRuby goes here: https://github.com/ruby/ruby/blob/5ca51ddde81cd7f338d0dd495ceb8569def60647/bignum.c#L6218 (i.e., division to double of 2 bignums) |
Might be helpful to check what JRuby does here. |
@eregon It appears to use BigDecimal: https://github.com/jruby/jruby/blob/9.2.19.0/core/src/main/java/org/jruby/RubyBignum.java#L1188-L1200 |
I think we should use BigDecimal as well, that's a much easier way to get the correct answer without manually writing out a division algorithm (CRuby kind of does that). |
This is now fixed at 502f2c9. |
I've been enjoying truffleruby support on GitHub Actions, turning it on and off here and there. I turned it back on and got some differing behavior:
https://github.com/rickhull/compsci/actions/runs/1995013610
Here is https://github.com/rickhull/compsci/blob/master/test/fit.rb#L127
Note that the
-114
line is commented out. Truffleruby passes. The failed run is when the-114
value is used. Note also the comments:Here is
Fit.power
from https://github.com/rickhull/compsci/blob/master/lib/compsci/fit.rb#L143The text was updated successfully, but these errors were encountered: