Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8291240

JDK 19 and 20 slightly change double precision

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 19, 20
    • core-libs
    • 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

            rgiulietti Raffaello Giulietti
            dstadler Dominik Stadler
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: