[decimal] Re-implement BigDecimal.sqrt() with help of BigUInt.sqrt()
#108
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 includes significant updates to the BigDecimal benchmarking and implementation code. Key changes involve a re-implementation of the
sqrtfunction for improved efficiency and accuracy.Codebase Enhancements:
sqrtfunction insrc/decimojo/bigdecimal/exponential. Mojo:sqrtimplementation with a more efficient method usingBigUInt.sqrt(), which adjusts the scale and coefficient directly for better performance and accuracy.sqrt_decimal_approachfunction to preserve the old implementation for reference.Benchmarking Updates:
Enhanced the square root benchmark (
benches/bigdecimal/bench_bigdecimal_sqrt.mojo):PRECISIONalias for consistent precision handling across operations.PRECISIONvalue instead of a fixed precision of 28.Removed the
scale_up_by_power_of_10benchmark entirely, including its import inbenches/bigdecimal/bench.mojoand its invocation in the main function.