Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request introduces several changes to the benchmarking and arithmetic functionalities in the decimojo project. The most significant updates include the improvements to the power function for Decimal values, the addition of new benchmark cases, and the introduction of new constants.

Power Function Enhancements:

  • src/decimojo/exponential.mojo: Enhanced the power function to handle both integer and non-integer exponents using the identity ( x^y = e^{(y \cdot \ln(x))} ). Improved error handling and added support for common fractional exponents.

Benchmarking Enhancements:

  • benches/bench.mojo: Added new benchmark cases for bench_ln and bench_power functions.
  • benches/bench_power.mojo: Introduced comprehensive benchmarks for the Decimal power function, including various test cases and logging of results.
  • mojoproject.toml: Added new test and benchmark entries for test_power and bench_power.

Arithmetic Function Improvements:

  • src/decimojo/arithmetics.mojo: Commented out debug print statements in the multiply function for cleaner output.
  • src/decimojo/constants.mojo: Added new decimal constants M0D5 and M0D25 to represent 0.5 and 0.25 as Decimal values.
  • src/decimojo/decimal.mojo: Updated __pow__ method to handle different types of exponents and added error handling.

These changes collectively improve the functionality and performance of the decimojo library, especially in handling complex arithmetic operations and benchmarking their performance.

@forfudan forfudan merged commit 467be20 into main Mar 16, 2025
1 of 2 checks passed
@forfudan forfudan deleted the power branch March 16, 2025 22:39
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