Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request includes several changes related to benchmarks, arithmetic operations, and project configuration. The most important changes are the implementation of ln() function that gets natural logarithm, the addition of a new benchmark for the natural logarithm function, improvements to the Decimal arithmetic operations, and updates to the project configuration files.

ln() function and method

  • Implemented ln() function that gets natural logarithm.

Benchmarking Enhancements:

  • Added a comprehensive benchmark for the Decimal natural logarithm function (ln) in benches/bench_ln.mojo which compares performance against Python's decimal module with 20 diverse test cases.

Pre-calculated constants:

  • Added the constants module which contains many pre-calculated constants.

Arithmetic Operation Improvements:

  • Simplified the add and multiply functions in src/decimojo/arithmetics.mojo by using the Decimal.from_uint128 method to create Decimal objects from UInt128 values, replacing the previous method of extracting 32-bit components.

Project Configuration Updates:

  • Updated mojoproject.toml to include new test and benchmark commands for the natural logarithm function.
  • Corrected the test command for the division operation in mojoproject.toml.

Other Changes:

  • Added the ln function to the src/decimojo/__init__.mojo file's import list.
  • Removed an unused import in benches/bench_exp.mojo.

@forfudan forfudan merged commit 4af879a into main Mar 16, 2025
1 of 2 checks passed
@forfudan forfudan deleted the ln branch March 16, 2025 21:17
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