harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Kishenko" <dkishe...@gmail.com>
Subject [classlib][math] compatibility: BigDecimal.valueOf(0L, -22).shortValueExact() RI throws ArithmeticException
Date Wed, 02 Aug 2006 09:24:39 GMT
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


Mime
View raw message