Le 12/01/2014 14:57, Thomas Neidhart a écrit :
> Hi,
> 
> in MATH-1070 we have discovered that calling Precision.round(x, y)
> behaves differently for float and double values when the value to be
> rounded is negative zero:
> 
> Precision.round(-0.0d, 0) = 0.0
> Precision.round(-0.0f, 0) = -0.0
> 
> The reason being that in the double case, the value is converted to a
> BigDecimal, which loses the sign in this case, see
> http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#BigDecimal%28java.lang.String%29.
> 
> I could not find anything related to the IEEE standard for rounding
> numbers for this case. Looking at octave and python, there the sign is
> kept and this would also be a reasonable behavior imho.
> 
> Thus I would propose to add a special case for this to the
> Precision.round method.

This sounds reasonable to me.

Luc

> 
> Thomas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to