[integer] Implement sqrt() for BigUInt
#107
Merged
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.
This pull request introduces several changes, primarily focusing on adding new functionality, improving debugging, and optimizing arithmetic operations for the
BigUInttype. Additionally, it includes updates to documentation and minor refactoring. Below is a summary of the most significant changes:New Functionality
benches/biguint/bench.mojo. This includes importing thebench_sqrtfunction, updating the command options to includesqrt, and adding the corresponding execution logic.subtract_inplace_by_uint32function to perform in-place subtraction of aUInt32value from aBigUIntnumber. This function includes handling for borrow propagation.Debugging Enhancements
debug_assertstatements across arithmetic operations (add,subtract,multiply, etc.) to check for uninitializedBigUIntvalues and ensure there are no leading zero words. These assertions improve error detection and debugging during development.Optimizations and Refactoring
BigUInt(words=y.words[bounds_y[0]:bounds_y[1]])) with the more efficientBigUInt.from_slicemethod in several places, improving clarity and performance.multiply_slices_karatsubafunction by adding a zero-check for input slices, avoiding unnecessary computations when one of the slices is zero.Documentation Updates
docs/todo.mdfile to reflect completed tasks and clarify the purpose of the to-do list.Code Cleanup
negative_inplaceandabsolute_inplace, as they served no meaningful purpose for unsigned integers.