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
- csr of
-
JDK-8021322 [Fmt-Ch] Implementation of ChoiceFormat math methods should delegate to java.lang.Math methods
-
- Resolved
-