Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-1248

[classlib][math] exception compatibility BigDecimal.valueOf(0L, -22).shortValueExact()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      ============= 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.

        Attachments

          Activity

            People

            • Assignee:
              zakha Alexei Zakharov
              Reporter:
              dkishenko Denis Kishenko
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: