JDK 21 |
---|
21Resolved |
Relates :
|
|
Relates :
|
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"`.