You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Denis Kishenko <dk...@gmail.com> on 2006/08/02 11:24:39 UTC
[classlib][math] compatibility: BigDecimal.valueOf(0L, -22).shortValueExact() RI throws ArithmeticException
Let's discuss compatibility issue.
Test ---------------------------------------------------------------------------------
import java.math.BigDecimal;
public class Test {
public static void main(String args[] ) {
BigDecimal.valueOf(0L, -22).shortValueExact();
}
}
Results -----------------------------------------------------------------------------
RI throws java.lang.ArithmeticException: Overflow
Harmony throws nothing, just return 0
Spec 1.5 --------------------------------------------------------------------------
public short shortValueExact()
Throws:
ArithmeticException - if this has a nonzero fractional part, or
will not fit in a short.
Actually BigDecimal.valueOf(0L, -22) equals 0E+22. So Harmony follows
spec and looks absolutely logically. I suggest file this issue and
don't change Harmony.
--
Denis M. Kishenko
Intel Middleware Products Division
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org