Skip to content

Fix nth_root_exact panic on negative even roots #56

Merged
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:bug-25
Feb 23, 2026
Merged

Fix nth_root_exact panic on negative even roots #56
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:bug-25

Conversation

@sylvestre
Copy link
Copy Markdown
Contributor

Closes: #25

Reproduces the panic that occurs when calling nth_root_exact with even
roots on negative numbers, which should return None instead of panicking.

closes: uutils#25
@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented Feb 19, 2026

Merging this PR will degrade performance by 93.2%

⚡ 1 improved benchmark
❌ 3 regressed benchmarks
✅ 25 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation glass_pumpkin 33.9 ms 26.1 ms +29.63%
Simulation num-primes 22 ms 54.6 ms -59.67%
Simulation glass_pumpkin 3.2 ms 6.9 ms -54.45%
Simulation num-primes 759.5 ms 11,165.9 ms -93.2%

Comparing sylvestre:bug-25 (d9f280a) with main (75e7ea8)

Open in CodSpeed

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.97%. Comparing base (3f5db7d) to head (d9f280a).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #56      +/-   ##
==========================================
+ Coverage   78.64%   84.97%   +6.32%     
==========================================
  Files          13       14       +1     
  Lines        2585     3460     +875     
  Branches      230      240      +10     
==========================================
+ Hits         2033     2940     +907     
+ Misses        552      519      -33     
- Partials        0        1       +1     
Flag Coverage Δ
macos_latest 84.94% <100.00%> (+7.30%) ⬆️
ubuntu_latest 84.50% <100.00%> (+6.32%) ⬆️
windows_latest 17.63% <14.03%> (+2.92%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@sylvestre sylvestre merged commit dc9369e into uutils:main Feb 23, 2026
26 of 27 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.

nth_root_exact should return None rather than panic when answer is imaginary

1 participant