Harmony
  1. Harmony
  2. HARMONY-1248

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor 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.

        Activity

        Hide
        Alexei Zakharov added a comment -

        Seems to be a true NBD. Closed as WON'T FIX.

        Show
        Alexei Zakharov added a comment - Seems to be a true NBD. Closed as WON'T FIX.
        Hide
        Alexei Zakharov added a comment -

        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.

        Show
        Alexei Zakharov added a comment - 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.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development