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

Make use of the Double.toString(double) algorithm in java.util.Formatter

    XMLWordPrintable

Details

    • 19
    • b09
    • Verified

    Description

      Methods `Double.toString(double)` and `AbstractStringBuilder.append(double)` make use of an algorithm integrated in JDK 19 [1], replacing the one used in earlier release; similarly for the `float` counterparts `Float.toString(float)` and `AbstractStringBuilder.append(float)`.

      Class `java.util.Formatter`, however, uses another algorithm to format `double` and `float` values. This can lead to small discrepancies w.r.t. the outcomes of the above methods in certain rare cases, and conflicts with the specification which is based on `Double.toString(double)`. Therefore, to match the specification, `java.util.Formatter` should replace the current algorithm with a variant of the new one tailored for formatted output.

      ----

      [1] https://git.openjdk.java.net/jdk/commit/72bcf2aa03d53b0f68eb07a902575b4e8628d859

      Attachments

        Issue Links

          Activity

            People

              rgiulietti Raffaello Giulietti
              rgiulietti Raffaello Giulietti
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: