-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK-8283124: Add constant for tau to Math and StrictMath #7813
Conversation
/csr needed |
👋 Welcome back darcy! A progress list of the required criteria for merging this PR into |
Webrevs
|
Mailing list message from Raffaello Giulietti on core-libs-dev: Hello, I find it a bit disturbing that PI is specified with 21 digits whereas Greetings On 3/14/22 22:13, Brian Burkhalter wrote: |
Mailing list message from Hans Boehm on core-libs-dev: Couldn't the apiNote just say TAU == 2 * PI instead? I think the fact that On Mon, Mar 14, 2022 at 2:33 PM Raffaello Giulietti <
|
Mailing list message from Raffaello Giulietti on core-libs-dev: Right, and PI with 16 digits (or 17). On 3/14/22 22:51, Hans Boehm wrote:
|
Yes; after further thought, I agree having tau = 2.0*pi is preferable. Just to go through the logic, 2.0 is exactly representable in binary floating-point and an in-range multiple by two is just an exponent adjustment. Floating-point exponent transitions occur at 2.0 = 0x1 * 2^1, 4.0 = 0x1 * 2^2, and 8.0 = 0x1 * 2^3. The value of pi is between 2.0 and 4.0 and has an exponent of 1 while the value of tau ~= 6.28 is between 4.0 and 8.0 and has an exponent of 2. So whatever the closest floating-point value to exact pi is, 2.0 * Math.pi will be the closest floating-point value to tau. |
Mailing list message from Joseph D. Darcy on core-libs-dev: Hi Raffaello, With changing TAU to be set to 2.0 * PI, I'll file a follow-up bug to Thanks, -Joe On 3/14/2022 2:32 PM, Raffaello Giulietti wrote:
|
@jddarcy This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
Mailing list message from Kevin Bourrillion on core-libs-dev: On Mon, Mar 14, 2022 at 4:16 PM Joe Darcy <darcy at openjdk.java.net> wrote: Yes; after further thought, I agree having tau = 2.0*pi is preferable. Kinda reads like it's taking a stand on which of the two is the *real* Can PI have a @see link to this so that people know about it? (I'll just mention that {from,to}Radians would also benefit from some -- |
Mailing list message from Kevin Bourrillion on core-libs-dev: I did a subjective eval of 30 random usages of Math.PI in our codebase. I These usages really wanted -- * Math.toRadians (6) By the last one, I mean that the more a person has read, understood, and I suppose that introducing a new cause for subjective arguments between (On a side note, the real-world value for "they should just use On Mon, Mar 14, 2022 at 6:23 PM Kevin Bourrillion <kevinb at google.com> wrote:
-- |
/integrate |
Going to push as commit 05a83e0. |
Add a constant for tau, 2pi, to Math and StrictMath. Since 2pi is a very common value in mathematical formulas, it is helpful to give it a distinct constant.
Please also review the CSR https://bugs.openjdk.java.net/browse/JDK-8283136
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7813/head:pull/7813
$ git checkout pull/7813
Update a local copy of the PR:
$ git checkout pull/7813
$ git pull https://git.openjdk.java.net/jdk pull/7813/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7813
View PR using the GUI difftool:
$ git pr show -t 7813
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7813.diff