-
Sub-task
-
Resolution: Delivered
-
P4
-
19
-
Fix Understood
-
generic
-
generic
The specification of these methods is now tighter than in earlier releases and the new implementation fully adheres to it.
As a consequence, some returned strings are now shorter than when using earlier releases, and for inputs at the extremes of the subnormal ranges near zero, might look differently. However, the number of cases where there's a difference in output is quite small compared to the sheer number of possible `double` and `float` inputs.
One example is `Double.toString(2e23)`, which now returns `"2.0E23"`, whereas in earlier releases it returns `"1.9999999999999998E23"`.
Another example, in the `double` subnormal range, is `Double.toString(1e-323)` which now returns `"9.9E-324"`, as mandated by the new specification.
As a consequence, some returned strings are now shorter than when using earlier releases, and for inputs at the extremes of the subnormal ranges near zero, might look differently. However, the number of cases where there's a difference in output is quite small compared to the sheer number of possible `double` and `float` inputs.
One example is `Double.toString(2e23)`, which now returns `"2.0E23"`, whereas in earlier releases it returns `"1.9999999999999998E23"`.
Another example, in the `double` subnormal range, is `Double.toString(1e-323)` which now returns `"9.9E-324"`, as mandated by the new specification.
- relates to
-
JDK-8301383 Release Note: `java.util.Formatter` May Return Slightly Different Results on `double` and `float`
-
- Resolved
-
-
JDK-8291240 JDK 19 and 20 slightly change double precision
-
- Closed
-
-
JDK-4511638 Double.toString(double) sometimes produces incorrect results
-
- Resolved
-