Java 8 RFR 8010430: Math.round has surprising behavior for odd values of ulp 1

Brian Burkhalter brian.burkhalter at
Wed Aug 28 14:48:40 UTC 2013

On Aug 27, 2013, at 7:44 PM, Dmitry Nadezhin wrote:

> Is it reasonable to make specification clearer ?
> Either to return JLS 1 specification:
> <<<
> The result is rounded to an integer by adding , taking the floor of the result, and casting the result to type long.
> >>>

This verbiage would imply no change to the implementation with the odd ULP unity cases continuing to exhibit the problem described in the issue.

> or to replace "rounding up" with "rounding to positive infinity":
> <<<
> Returns the closest {@code int} to the argument, with ties rounding to positive infinity.
> >>>

This change could accompany the implementation change I posted in the updated webrev.



More information about the core-libs-dev mailing list