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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: