Skip to content
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

8271225: Add floorDivExact() method to java.lang.[Strict]Math #4941

Closed
wants to merge 5 commits into from

Conversation

bplb
Copy link
Member

@bplb bplb commented Jul 29, 2021

Add methods floorDivExact(int,int) and floorDivExact(long,long) to java.lang.Math and java.lang.StrictMath.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8271225: Add floorDivExact() method to java.lang.[Strict]Math

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4941/head:pull/4941
$ git checkout pull/4941

Update a local copy of the PR:
$ git checkout pull/4941
$ git pull https://git.openjdk.java.net/jdk pull/4941/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4941

View PR using the GUI difftool:
$ git pr show -t 4941

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4941.diff

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
phillebaba Philip Laine
@bridgekeeper
Copy link

bridgekeeper bot commented Jul 29, 2021

👋 Welcome back bpb! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@bplb
Copy link
Member Author

bplb commented Jul 29, 2021

The floorDivExact() methods are identical to their floorDiv() counterparts aside from that they throw an ArithmeticException when the dividend is MIN_VALUE and the divisor is -1. These methods behave with respect to the methods floorDiv() as the methods divideExact() behave with respect to the division operator /.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 29, 2021
@openjdk
Copy link

openjdk bot commented Jul 29, 2021

@bplb The following label will be automatically applied to this pull request:

  • core-libs

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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jul 29, 2021
@mlbridge
Copy link

mlbridge bot commented Jul 29, 2021

Webrevs

@bplb
Copy link
Member Author

bplb commented Jul 30, 2021

/csr

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Jul 30, 2021
@openjdk
Copy link

openjdk bot commented Jul 30, 2021

@bplb this pull request will not be integrated until the CSR request JDK-8271518 for issue JDK-8271225 has been approved.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@rgiulietti
Copy link
Contributor

Hello @bplb,

the doc of floorDivExact() is not, well..., exact.

For example,

The floor rounding mode gives different results from truncation
when the exact result is negative.

The truth is that the results are different when the exact quotient is not an integer and is negative.
The description following this sentence is imprecise as well.

The doc seems to have been copied and adapted from the doc of floorDiv(), which is imprecise in the first place.
You might want to take a look at PR 4963 which addresses this and wait until that one is thoroughly discussed for mathematical accuracy and correct wording.

Greetings
Raffaello

@bplb
Copy link
Member Author

bplb commented Aug 3, 2021

@rgiulietti Yes, that doc was copied. I tend to agree that it would be better to get 4963 right and hold off on this PR until then.

bplb added 3 commits August 5, 2021 09:58

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@bplb
Copy link
Member Author

bplb commented Aug 5, 2021

CSR updated to match this PR.

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Aug 19, 2021
@bplb
Copy link
Member Author

bplb commented Aug 19, 2021

The CSR for this PR has been approved.

@openjdk
Copy link

openjdk bot commented Aug 30, 2021

@bplb 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:

8271225: Add floorDivExact() method to java.lang.[Strict]Math

Reviewed-by: darcy

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 224 new commits pushed to the master branch:

  • 0609421: 8272347: ObjectMethods::bootstrap should specify NPE if any argument except lookup is null
  • 7fc8540: 8260265: UTF-8 by Default
  • 3204853: 8272343: Remove MetaspaceClosure::FLAG_MASK
  • fecefb8: 8271302: Regex Test Refresh
  • f18c0fa: 8271560: sun/security/ssl/DHKeyExchange/LegacyDHEKeyExchange.java still fails due to "An established connection was aborted by the software in your host machine"
  • 5aaa20f: 8272861: Add a micro benchmark for vector api
  • 7a01ba6: 8272093: Extract evacuation failure injection from G1CollectedHeap
  • 98b9d98: 8272797: Mutex with rank safepoint_check_never imply allow_vm_block
  • f11e099: 8272651: G1 heap region info print order changed by JDK-8269914
  • fbffa54: 8270438: "Cores to use" output in configure is misleading
  • ... and 214 more: https://git.openjdk.java.net/jdk/compare/3ab95d19174100f440e2274d5b2c3119fb55e9e1...master

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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 30, 2021
@bplb
Copy link
Member Author

bplb commented Aug 31, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Aug 31, 2021

Going to push as commit e551852.
Since your change was applied there have been 229 commits pushed to the master branch:

  • e671255: 8237567: Refactor G1-specific code in shared VM_CollectForMetadataAllocation
  • 9bc7cc5: 8273033: SerialGC: remove obsolete comments
  • 841e394: 8159979: During initial mark, preparing all regions for marking may take a significant amount of time
  • 98fa533: 8273100: Improve AbstractStringBuilder.append(String) when using CompactStrings
  • 9732fbe: 8273153: Consolidate file_exists into os:file_exists
  • 0609421: 8272347: ObjectMethods::bootstrap should specify NPE if any argument except lookup is null
  • 7fc8540: 8260265: UTF-8 by Default
  • 3204853: 8272343: Remove MetaspaceClosure::FLAG_MASK
  • fecefb8: 8271302: Regex Test Refresh
  • f18c0fa: 8271560: sun/security/ssl/DHKeyExchange/LegacyDHEKeyExchange.java still fails due to "An established connection was aborted by the software in your host machine"
  • ... and 219 more: https://git.openjdk.java.net/jdk/compare/3ab95d19174100f440e2274d5b2c3119fb55e9e1...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Aug 31, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Aug 31, 2021
@openjdk
Copy link

openjdk bot commented Aug 31, 2021

@bplb Pushed as commit e551852.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@bplb bplb deleted the Math-floorDivExact-8271225 branch August 31, 2021 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

None yet

3 participants