Re: RFR: JDK-8283143: Use minimal-length literals to initialize PI and E constants [v2]
> 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. Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: Update copyright. - Changes: - all: https://git.openjdk.java.net/jdk/pull/7814/files - new: https://git.openjdk.java.net/jdk/pull/7814/files/3bf9de9f..f4c0e63e Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk=7814=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk=7814=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 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
Re: RFR: JDK-8283143: Use minimal-length literals to initialize PI and E constants
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=7814=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
Re: RFR: JDK-8283143: Use minimal-length literals to initialize PI and E constants
On Tue, 15 Mar 2022 01:36:14 GMT, 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. I've verified that the shorter literals result in the same double bit pattern. - Marked as reviewed by smarks (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/7814
RFR: JDK-8283143: Use minimal-length literals to initialize PI and E constants
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=7814=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