Skip to content

Detect overflow in Pow.pow - #7752

Merged
DenizAltunkapan merged 2 commits into
TheAlgorithms:masterfrom
Prasad-Pitke:fix/pow-overflow-check-pr
Nov 14, 2026
Merged

DenizAltunkapan merged 2 commits into
TheAlgorithms:masterfrom
Prasad-Pitke:fix/pow-overflow-check-pr

Conversation

@Prasad-Pitke

@Prasad-Pitke Prasad-Pitke commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Use Math.multiplyExact so Pow.pow throws ArithmeticException instead of silently wrapping when a result exceeds long range.
  • Document the overflow behavior.

Fixes #7751

@codecov-commenter

codecov-commenter commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.40%. Comparing base (401e253) to head (6c87037).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #7752   +/-   ##
=========================================
  Coverage     82.40%   82.40%           
+ Complexity     8487     8486    -1     
=========================================
  Files           846      846           
  Lines         26245    26245           
  Branches       5128     5128           
=========================================
+ Hits          21627    21628    +1     
+ Misses         3828     3827    -1     
  Partials        790      790           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DenizAltunkapan
DenizAltunkapan enabled auto-merge (squash) November 14, 2026 09:47
@DenizAltunkapan
DenizAltunkapan merged commit a006205 into TheAlgorithms:master Nov 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Pow.pow silently wraps when the result exceeds long range

3 participants