The new decimal literals have indeed the minimal length required to recover the doubles closest to the true mathematical values.

Raffaello



On 3/15/22 02:43, Joe Darcy wrote:
Depending on the range of the number line, a double value has between 15 and 17 
digits of decimal precision. The literals used to initialize Math.PI and Math.E 
have several digits more precision than that maximum.

That is potentially confusing to readers of the code and the minimum length 
strings to exactly represent the value in question should be used instead.

-------------

Commit messages:
  - JDK-8283143: Use minimal-length literals to initialize PI and E constants

Changes: https://git.openjdk.java.net/jdk/pull/7814/files
  Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7814&range=00
   Issue: https://bugs.openjdk.java.net/browse/JDK-8283143
   Stats: 4 lines in 2 files changed: 0 ins; 0 del; 4 mod
   Patch: https://git.openjdk.java.net/jdk/pull/7814.diff
   Fetch: git fetch https://git.openjdk.java.net/jdk pull/7814/head:pull/7814

PR: https://git.openjdk.java.net/jdk/pull/7814

Reply via email to