[decimal] Implement root() for BigDecimal
#80
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 a new root function for the BigDecimal library and makes several updates to the benchmarking and testing code to support this new functionality. Additionally, some improvements and optimizations have been made to existing functions.
Key changes include:
New Functionality:
rootfunction to theBigDecimalstruct for calculating the nth root of a BigDecimal number.integer_rootandis_integer_reciprocal_and_returnhelper functions inexponential.mojoto support the new root calculation.Benchmarking Updates:
benches/bigdecimal/bench.mojoto include the newrootbenchmark, adding the necessary imports, command handling, and execution logic. [1] [2] [3] [4]Precision Handling:
sqrtfunction calls inbench_bigdecimal_sqrt.mojoandtest_bigdecimal_exponential.mojoto include a precision parameter for consistency and accuracy. [1] [2] [3] [4]Utility Enhancements:
is_onefunction to theBigDecimalstruct to check if a number represents one.These changes enhance the functionality and precision of the BigDecimal library, particularly with the addition of the new root calculation capabilities.