Skip to content

Conversation

@forfudan
Copy link
Owner

@forfudan forfudan commented Apr 3, 2025

This pull request includes several updates to the BigDecimal and related arithmetic operations in the decimojo library. The changes primarily focus on adding new mathematical functions, optimizing existing methods, and improving precision handling.

New Mathematical Functions:

  • Added power, log, and log10 functions to BigDecimal for exponentiation and logarithmic calculations. (src/decimojo/bigdecimal/bigdecimal.mojo, src/decimojo/bigdecimal/exponential.mojo) [1] [2] [3]
  • Introduced is_integer and is_odd methods to BigDecimal to check if the number is an integer or odd. (src/decimojo/bigdecimal/bigdecimal.mojo)

Precision Handling Improvements:

  • Modified the true_divide function to accept precision as a mandatory argument. (src/decimojo/bigdecimal/arithmetics.mojo)
  • Updated various methods to ensure precision is consistently handled, including __truediv__, __itruediv__, and power. (src/decimojo/bigdecimal/bigdecimal.mojo) [1] [2] [3]

Optimization and Special Cases:

  • Added precomputed values and special case handling for logarithmic functions to improve performance. (src/decimojo/bigdecimal/exponential.mojo) [1] [2]
  • Introduced floor_divide_inplace_by_2 method to BigUInt for efficient division by 2. (src/decimojo/biguint/biguint.mojo)

Documentation Updates:

  • Added internal notes to document the discrepancies in power function results between different libraries. (docs/internal_notes.md)

@forfudan forfudan merged commit 6d64a30 into main Apr 3, 2025
1 check passed
@forfudan forfudan deleted the exp branch April 3, 2025 20:55
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