Skip to content

implement Karatsuba Square Root - #80

Merged
cuviper merged 2 commits into
rust-num:mainfrom
cuviper:karatsuba-sqrt
Aug 12, 2026
Merged

implement Karatsuba Square Root#80
cuviper merged 2 commits into
rust-num:mainfrom
cuviper:karatsuba-sqrt

Conversation

@cuviper

@cuviper cuviper commented Aug 11, 2026

Copy link
Copy Markdown
Member

Previously 128-bit sqrt used recursion to avoid large divisions, but the Karatsuba Square Root algorithm makes it straightforward to do most of the work in u64 and then adjust for u128.

The existing u128::sqrt_rand benchmark reduced from 91,559.66 to 17,028.33 ns/iter on my machine.

@cuviper
cuviper enabled auto-merge August 11, 2026 23:39
@cuviper
cuviper added this pull request to the merge queue Aug 11, 2026
Merged via the queue into rust-num:main with commit 1377fb6 Aug 12, 2026
4 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.

1 participant