Skip to content

Fix bigdecimal infinity round#4379

Merged
headius merged 1 commit intojruby:masterfrom
kirs:fix-infinity
Dec 14, 2016
Merged

Fix bigdecimal infinity round#4379
headius merged 1 commit intojruby:masterfrom
kirs:fix-infinity

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 commented Dec 14, 2016

Looks ok to me!

@headius headius merged commit 48f1ac2 into jruby:master Dec 14, 2016
@headius headius added this to the JRuby 9.1.7.0 milestone Dec 14, 2016
@kirs kirs deleted the fix-infinity branch February 28, 2018 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants