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

Add BigDecimal.TWO

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 19
    • core-libs
    • None
    • minimal
    • Adding a new constant should not pose a compatibility issue.
    • Java API
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: