-
Sub-task
-
Resolution: Delivered
-
P4
-
21
-
In Review
-
generic
-
generic
The implementation of `java.util.Formatter` for `double` and `float` conversions to decimal (`'e'`, `'E'`, `'f'`, `'g'`, `'G'`) is now aligned with the one in `Double.toString(double)`, which was changed in JDK 19.
As a consequence, in some rare circumstances, the outcomes may slightly differ from the ones in earlier releases.
One example is with `double` `2e23` and format `"%.16e"`. With this change, the outcome is `2.0000000000000000e+23`, while earlier releases produce `1.9999999999999998e+23`. Any smaller precision in the format (e.g., "%.15e") on this value will produce outcomes that are equal to each other, though.
Another example is with `double` `9.9e-324` and format `"%.2g"`. The new outcome is `9.9e-324`, but earlier releases generate `"1.0e-323"`.
As a consequence, in some rare circumstances, the outcomes may slightly differ from the ones in earlier releases.
One example is with `double` `2e23` and format `"%.16e"`. With this change, the outcome is `2.0000000000000000e+23`, while earlier releases produce `1.9999999999999998e+23`. Any smaller precision in the format (e.g., "%.15e") on this value will produce outcomes that are equal to each other, though.
Another example is with `double` `9.9e-324` and format `"%.2g"`. The new outcome is `9.9e-324`, but earlier releases generate `"1.0e-323"`.
- relates to
-
JDK-8291475 Release Note: Double.toString(double) and Float.toString(float) may Return Slightly Different Results
- Resolved
-
JDK-8301387 Align the specification of java.util.Formatter float conversions to the implementation
- Closed