Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request includes significant updates to the BigDecimal benchmarking and implementation code. Key changes involve a re-implementation of the sqrt function for improved efficiency and accuracy.

Codebase Enhancements:

  • Re-implemented the sqrt function in src/decimojo/bigdecimal/exponential. Mojo:
    • Replaced the old sqrt implementation with a more efficient method using BigUInt.sqrt(), which adjusts the scale and coefficient directly for better performance and accuracy.
    • Introduced a new sqrt_decimal_approach function to preserve the old implementation for reference.

Benchmarking Updates:

  • Enhanced the square root benchmark (benches/bigdecimal/bench_bigdecimal_sqrt.mojo):

    • Introduced a PRECISION alias for consistent precision handling across operations.
    • Updated the square root computation to use the new PRECISION value instead of a fixed precision of 28.
    • Added extensive test cases for very large decimal numbers, ranging from 100-word to 5000-word decimals, to stress-test the square root implementation.
  • Removed the scale_up_by_power_of_10 benchmark entirely, including its import in benches/bigdecimal/bench.mojo and its invocation in the main function.

@forfudan forfudan merged commit 755573d into main Jul 15, 2025
1 check passed
@forfudan forfudan deleted the work branch July 15, 2025 17:21
forfudan added a commit that referenced this pull request Jul 15, 2025
forfudan added a commit that referenced this pull request Jul 18, 2025
forfudan added a commit that referenced this pull request Jul 24, 2025
forfudan added a commit that referenced this pull request Jul 26, 2025
forfudan added a commit that referenced this pull request Jul 31, 2025
forfudan added a commit that referenced this pull request Aug 3, 2025
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.

2 participants