[decimal] Implement ln() function that gets natural logarithm
#36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theDecimalarithmetic operations, and updates to the project configuration files.ln()function and methodln()function that gets natural logarithm.Benchmarking Enhancements:
Decimalnatural logarithm function (ln) inbenches/bench_ln.mojowhich compares performance against Python's decimal module with 20 diverse test cases.Pre-calculated constants:
constantsmodule which contains many pre-calculated constants.Arithmetic Operation Improvements:
addandmultiplyfunctions insrc/decimojo/arithmetics.mojoby using theDecimal.from_uint128method to createDecimalobjects fromUInt128values, replacing the previous method of extracting 32-bit components.Project Configuration Updates:
mojoproject.tomlto include new test and benchmark commands for the natural logarithm function.mojoproject.toml.Other Changes:
lnfunction to thesrc/decimojo/__init__.mojofile's import list.benches/bench_exp.mojo.