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 bigdecimal infinity round #4379

Merged
merged 1 commit into from Dec 14, 2016
Merged

Fix bigdecimal infinity round #4379

merged 1 commit into from Dec 14, 2016

Conversation

@kirs
Copy link
Contributor

@kirs kirs commented Dec 12, 2016

Expected: MRI can round(0) Infinity:

ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]

BigDecimal("Infinity").round(0)
=> #<BigDecimal:7fad7f83d798,'Infinity',9(18)>

But JRuby-master raises an error:

jruby 9.1.7.0-SNAPSHOT (2.3.1) 2016-12-12 fd9515b Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64]

BigDecimal("Infinity").round(0)
FloatDomainError: Computation results to 'Infinity'
    org/jruby/ext/bigdecimal/RubyBigDecimal.java:1368:in `round'

We raised an error when the method was called with no argument, but we checked it in the wrong way so round(0) was broken.

@enebo @headius

@headius
Copy link
Member

@headius headius commented Dec 14, 2016

Looks ok to me!

@headius headius merged commit 48f1ac2 into jruby:master Dec 14, 2016
1 check failed
1 check failed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
@headius headius added this to the JRuby 9.1.7.0 milestone Dec 14, 2016
@kirs kirs deleted the kirs:fix-infinity branch Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.