Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request includes several changes across different files to optimize the performance of multiply and exp and improve the functionality and readability of the codebase. The changes involve importing and utilizing new modules, refactoring functions for better clarity, and fixing minor issues.

This PR significantly improve the speed when multiplying two decimals with many digits after the decimal points (>20). This indirectly enhances the performance of exp significantly.

Utility Functions:

  • Refactored the truncate_to_max function to use power_of_10 for calculating powers of ten.
  • Optimize number_of_digit by using direct lookup instead of calculating ad hoc.

Arithmetic Functions:

  • Refactored the add and multiply functions for better readability and efficiency. This includes using Decimal.from_uint128 for creating Decimal objects and improving the handling of scale and rounding.

@forfudan forfudan merged commit a33d891 into main Mar 15, 2025
1 of 2 checks passed
@forfudan forfudan deleted the cache branch March 15, 2025 18:54
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