jruby/jruby — pull request #1808 by robin850 (2014-07-12 18:23:45+00:00)
Title: Fix BigDecimal#round behavior with NAN and INFINITY

Hello,

JRuby's behavior of `BigDecimal#round` with `BigDecimal::NAN` and `BigDecimal::INFINITY` is kind of weird as it computes a value of 0.0. Currently, the problem is that under the hood, JRuby defines the constant according to [`BigDecimal.ZERO`](https://github.com/jruby/jruby/blob/f089aaf97bd742b4f9840df4308033363ebe2c38/core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java#L556) and [`round`](https://github.com/jruby/jruby/blob/f089aaf97bd742b4f9840df4308033363ebe2c38/core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java#L1186) uses the value to compute the "rounding" but it should simply return the constant itself.

Moreover, when we call `#round` without any argument on these constants, a `FloatDomainError` should be raised.

This area of code on this branch is a bit different from `master` so here's [a diff](https://gist.github.com/robin850/f318aecdbcdac76ebcc5) that you can `git apply` to simplify the merge process between branches.

Have a nice day.