Skip to main content

[JSR-354] Fwd: Math.round(...) and bug 6430675

  • From: Anatole Tresch <atsticks@...>
  • To: javamoney-list <jcurrency_mail@...>
  • Subject: [JSR-354] Fwd: Math.round(...) and bug 6430675
  • Date: Sat, 2 Feb 2013 07:04:41 +0100

Mab be also be intesting for some of us...
Cheers
Anatole

-
Anatole Tresch
Glärnischweg 10
8620 Wetzikon
Tel +41 (43) 317 05 30
-
Send from Mobile

Anfang der weitergeleiteten E‑Mail:

Von: Brian Burkhalter <brian.burkhalter@...>
Datum: 2. Februar 2013 02:19:43 MEZ
An: core-libs-dev@...
Betreff: Re: Math.round(...) and bug 6430675

Hi Jeff,

Based on my tests it looks as if you are correct about the behavior. Would you mind filing an issue so that this may be tracked?

Thanks,

Brian

On Jan 31, 2013, at 1:26 PM, Jeff Hain wrote:

Hi.

Since 6430675 fix, Math.round(float) and Math.round(double)
specs no longer specify rounding by adding 0.5 and then using floor,
and let the user believe that they "now round up properly".

However playing with fresh JDK 7 and 8 versions I saw that
these methods still exhibit some suprising results coming
from adding 0.5 and then using floor.
For example, for odd values in [8388609.0f,16777215.0f] or
[-16777215.0f,-8388609.0f], which are mathematical integers,
Math.round(float) returns value+1.

Shouldn't the references to floor(value+0.5(f/d)) be restored
in the specs, or the implementations having a work-around for
these cases?

-Jeff



[JSR-354] Fwd: Math.round(...) and bug 6430675

Anatole Tresch 02/02/2013
 
 
Close
loading
Please Confirm
Close