[integer] Implement Burnikel-Ziegler fast recursive division algorithm for BigUInt
#103
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 PR implements the Burnikel-Ziegler fast recursive division algorithm which significantly improves the performance of large-number divisions (particularly when there are thousands of words). It achieves a realized time complexity of O(n^1.585) (3x time when digits are doubled) instead of the O(n^2) (4x time when digits are doubled).
Major Division Algorithm Improvements
1. Burnikel-Ziegler Algorithm Implementation
floor_divide_burnikel_ziegler()function with cutoff at 64 wordsfloor_divide_two_by_one()floor_divide_three_by_two()floor_divide_three_by_two_uint32()floor_divide_four_by_two_uint32()2. Division Strategy Refactoring
floor_divide_general()→floor_divide_school()floor_divide():calculate_normalization_factor()helper functionBenchmark and Testing Enhancements
3. Extended Test Coverage
4. Improved Benchmarking
Code Quality Improvements
5. Constructor Safety
6. Build Process
Performance Impact
The main achievement is dramatically improved performance for large number division:
This is a significant algorithmic improvement that should provide substantial speedups for large number operations while maintaining correctness for all input sizes.