JDK-8291475 : Release Note: Double.toString(double) and Float.toString(float) May Return Slightly Different Results
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 19
  • Priority: P4
  • Status: Resolved
  • Resolution: Delivered
  • OS: generic
  • CPU: generic
  • Submitted: 2022-07-28
  • Updated: 2022-08-11
  • Resolved: 2022-08-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 19
19Resolved
Related Reports
Relates :  
Relates :  
Description
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.