Repository navigation
fix(maths): use overflow-safe Euclidean GCD in LeastCommonMultiple - #7795
Merged
DenizAltunkapan merged 3 commits intoDec 2, 2026
Merged
DenizAltunkapan merged 3 commits into
DenizAltunkapan merged 3 commits into
Conversation
mayankcodes-dev
requested review from
DenizAltunkapan,
alxkm and
yanglbme
as code owners
December 2, 2026 18:04
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7795 +/- ##
============================================
+ Coverage 82.94% 82.97% +0.03%
- Complexity 8643 8677 +34
============================================
Files 848 848
Lines 26455 26507 +52
Branches 5160 5172 +12
============================================
+ Hits 21943 21995 +52
- Misses 3725 3726 +1
+ Partials 787 786 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
DenizAltunkapan
approved these changes
Dec 2, 2026
DenizAltunkapan
left a comment
Member
There was a problem hiding this comment.
@mayankcodes-dev thanks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your change:
Replaces the
O(lcm / max)brute-force addition loop inLeastCommonMultiplewith anO(log(min(a, b)))overflow-safe Euclidean GCD implementation, matching the standard C++17std::lcmcontract.Bugs in the previous implementation:
Updated behavior & additions:
LeastCommonMultipleTestand adds full coverage for zeros, negative inputs,Integer.MIN_VALUE/Long.MIN_VALUEoverflow checks, varargs, andBigInteger.javac --release 21 -Xlint:all -Werror, JUnit 5, Checkstyle, andclang-format16.Checklist:
clang-format -i --style=file path/to/your/file.java