harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-1248) [classlib][math] exception compatibility BigDecimal.valueOf(0L, -22).shortValueExact()
Date Tue, 13 Mar 2007 15:59:09 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-1248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480451
] 

Alexei Zakharov commented on HARMONY-1248:
------------------------------------------

In the given example the fraction part is zero and the value itself should fit to short type
(since it is zero too). So it looks like RI behavior contradicts the spec. 

> [classlib][math] exception compatibility BigDecimal.valueOf(0L, -22).shortValueExact()
> --------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1248
>                 URL: https://issues.apache.org/jira/browse/HARMONY-1248
>             Project: Harmony
>          Issue Type: Bug
>          Components: Non-bug differences from RI
>            Reporter: Denis Kishenko
>         Assigned To: Alexei Zakharov
>            Priority: Minor
>
> ============= Spec ========================
> public short shortValueExact()
> Throws:
>   ArithmeticException - if this has a nonzero fractional part, or
> will not fit in a short.
> ================ Test =========================
> import java.math.BigDecimal;
> public class Test {
>   public static void main(String args[] ) {
>       BigDecimal.valueOf(0L, -22).shortValueExact();
>   }
> }
> ================ Output =====================
> RI throws java.lang.ArithmeticException: Overflow
> Harmony throws nothing, just return 0
> Actually BigDecimal.valueOf(0L, -22) equals 0E+22. So Harmony follows
> spec and looks absolutely logically.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message