Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8286841

Add BigDecimal.TWO

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 19
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Adding a new constant should not pose a compatibility issue.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Add the constant java.math.BigDecimal.TWO.

      Problem

      There is no constant java.math.BigDecimal.TWO which is inconsistent with java.math.BigInteger.TWO.

      Solution

      Add the constant java.math.BigDecimal.TWO.

      Specification

      --- a/src/java.base/share/classes/java/math/BigDecimal.java
      +++ b/src/java.base/share/classes/java/math/BigDecimal.java
      @@ -416,6 +416,14 @@ public class BigDecimal extends Number implements Comparabl
      e<BigDecimal> {
           public static final BigDecimal ONE =
               ZERO_THROUGH_TEN[1];
      
      +    /**
      +     * The value 2, with a scale of 0.
      +     *
      +     * @since  19
      +     */
      +    public static final BigDecimal TWO =
      +        ZERO_THROUGH_TEN[2];
      +
           /**
            * The value 10, with a scale of 0.
            *

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bpb Brian Burkhalter
              Reporter:
              phh Paul Hohensee
              Reviewed By:
              Raffaello Giulietti
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: