-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
19, 20
-
x86_64
-
linux_ubuntu
While trying to run unit tests of Apache POI with JDK 19 and 20 eary access builds, we found a small difference in handling of very small "double" numbers.
This may be intentional, but I could not find any mentioning in the release notes of changes in this area.
How to reproduce:
The following unit-test works in JDKs up to 18, but fails in latest JDK 19 and JDK 20 early access builds.
Reproducing code-snippet:
assertEquals("1.0E-323",
Double.toString(0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d));
Failure:
org.opentest4j.AssertionFailedError:
Expected :1.0E-323
Actual :9.9E-324
This may be intentional, but I could not find any mentioning in the release notes of changes in this area.
How to reproduce:
The following unit-test works in JDKs up to 18, but fails in latest JDK 19 and JDK 20 early access builds.
Reproducing code-snippet:
assertEquals("1.0E-323",
Double.toString(0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d));
Failure:
org.opentest4j.AssertionFailedError:
Expected :1.0E-323
Actual :9.9E-324
- relates to
-
JDK-8291475 Release Note: Double.toString(double) and Float.toString(float) may Return Slightly Different Results
- Resolved
-
JDK-4511638 Double.toString(double) sometimes produces incorrect results
- Resolved
-
JDK-8202555 Double.toString(double) sometimes produces incorrect results
- Closed