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

[Fmt-Ch] Implementation of ChoiceFormat math methods should delegate to java.lang.Math methods

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 12
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Adding an implementation note to the ChoiceFormat APIs about the delegation to the equivalent Math APIs

      Problem

      The ChoiceFormat's nextDouble(double), previousDouble(double), nextDouble(double, boolean) APIs are now delegated to the equivalent Math APIs which have similar functionality and are well tested. This change needs an implementation note to be added to these APIs and removal of the previous implementation specific description.

      Solution

      • Add an implementation note to the ChoiceFormat's nextDouble(double), previousDouble(double) and nextDouble(double, boolean) APIs about their method delegation behavior to the equivalent Math APIs
      • Remove the description related to the floating-point flags from nextDouble(double, boolean) API, which is not directly related as the direct use of methods (longBitsToDouble, doubleToLongBits, isNaN) are removed from the implementation and the control is now delegated to the Math.nextUp()/Math.nextDown() APIs.

      Specification

      • Changing nextDouble(double)

      from:

       * Finds the least double greater than {@code d}.
       * If {@code NaN}, returns same value.
       * <p>Used to make half-open intervals.

      to:

       * Finds the least double greater than {@code d}.
       * If {@code NaN}, returns same value.
       * <p>Used to make half-open intervals.
       *
       * @implNote This is equivalent to calling
       * {@link Math#nextUp(double) Math.nextUp(d)}
      • Changing previousDouble(double)

      from:

       * Finds the greatest double less than {@code d}.
       * If {@code NaN}, returns same value.

      to:

       * Finds the greatest double less than {@code d}.
       * If {@code NaN}, returns same value.
       *
       * @implNote This is equivalent to calling
       * {@link Math#nextDown(double) Math.nextDown(d)}
      • Changing nextDouble(double, boolean)

      from:

       * If {@code NaN}, returns same value.
       *
       * Does not affect floating-point flags,
       * provided these member functions do not:
       *          Double.longBitsToDouble(long)
       *          Double.doubleToLongBits(double)
       *          Double.isNaN(double)

      to:

       * If {@code NaN}, returns same value.
       *
       * @implNote This is equivalent to calling
       * {@code positive ? Math.nextUp(d) : Math.nextDown(d)}

      Webrev

      http://cr.openjdk.java.net/~nishjain/8021322/webrev.01/

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nishjain Nishit Jain
                Reporter:
                darcy Joe Darcy
                Reviewed By:
                Naoto Sato
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: