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
8271599: Javadoc of floorDiv() and floorMod() families is inaccurate in some places #4963
Conversation
/csr |
👋 Welcome back rgiulietti! A progress list of the required criteria for merging this PR into |
@rgiulietti has indicated that a compatibility and specification (CSR) request is needed for this pull request. |
@rgiulietti The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Looks fine; please make the same edits to StrictMath for a final code review and CSR. |
@@ -1247,7 +1247,7 @@ public static long unsignedMultiplyHigh(long x, long y) { | |||
/** | |||
* Returns the largest (closest to positive infinity) | |||
* {@code int} value that is less than or equal to the algebraic quotient. | |||
* There is one special case, if the dividend is the | |||
* There is one special case: if the dividend is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the "the" at the end of line 1250 can be deleted.
* returns the largest integer less than or equal to the quotient | ||
* while the {@code /} operator returns the smallest integer greater | ||
* than or equal to the quotient. | ||
* There's a difference if and only if the quotient is not an integer.<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "There's a difference" -> "They differ" ?
@@ -1290,7 +1292,7 @@ public static int floorDiv(int x, int y) { | |||
/** | |||
* Returns the largest (closest to positive infinity) | |||
* {@code long} value that is less than or equal to the algebraic quotient. | |||
* There is one special case, if the dividend is the | |||
* There is one special case: if the dividend is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, "the" can go away.
@@ -1319,7 +1321,7 @@ public static long floorDiv(long x, int y) { | |||
/** | |||
* Returns the largest (closest to positive infinity) | |||
* {@code long} value that is less than or equal to the algebraic quotient. | |||
* There is one special case, if the dividend is the | |||
* There is one special case: if the dividend is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete "the" again.
@@ -1051,10 +1051,10 @@ public static long unsignedMultiplyHigh(long x, long y) { | |||
/** | |||
* Returns the largest (closest to positive infinity) | |||
* {@code int} value that is less than or equal to the algebraic quotient. | |||
* There is one special case, if the dividend is the | |||
* There is one special case: if the dividend is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the"
@@ -1075,7 +1075,7 @@ public static int floorDiv(int x, int y) { | |||
/** | |||
* Returns the largest (closest to positive infinity) | |||
* {@code long} value that is less than or equal to the algebraic quotient. | |||
* There is one special case, if the dividend is the | |||
* There is one special case: if the dividend is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the"
@@ -1099,10 +1099,10 @@ public static long floorDiv(long x, int y) { | |||
/** | |||
* Returns the largest (closest to positive infinity) | |||
* {@code long} value that is less than or equal to the algebraic quotient. | |||
* There is one special case, if the dividend is the | |||
* There is one special case: if the dividend is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the"
Done yesterday (JDK-8271827). |
@rgiulietti 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 34 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jddarcy, @bplb) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@rgiulietti |
/sponsor |
Going to push as commit 9f1edaf.
Your commit was automatically rebased without conflicts. |
@bplb @rgiulietti Pushed as commit 9f1edaf. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hello,
please review the changes in documentation of floorDiv() and floorMod() in all their variants. Some are clarifications, some are corrections.
Here's an example of a confusing formulation in the current doc
Literally, the integer closest to zero is zero!
The doc of floorMod(int, int) also states:
That's a questionable advice, as the sum in parentheses can lead to irrecoverable overflow (beside requiring two divisions instead of one).
E.g., setting x = Integer.MAX_VALUE - 1, y = Integer.MAX_VALUE leads to the quite incorrect result -3, which is not even positive!
Greetings
Raffaello
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4963/head:pull/4963
$ git checkout pull/4963
Update a local copy of the PR:
$ git checkout pull/4963
$ git pull https://git.openjdk.java.net/jdk pull/4963/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4963
View PR using the GUI difftool:
$ git pr show -t 4963
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4963.diff