Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request includes several changes to the BigDecimal library, focusing on adding new functionalities, improving existing methods, and making the code more robust. The most important changes include the addition of new arithmetic operations, enhancements to rounding and comparison methods, and updates to the benchmarking script.

New Arithmetic Operations:

  • Added truncate_divide and truncate_modulo functions to src/decimojo/bigdecimal/arithmetics.mojo for performing truncated division and modulo operations.
  • Implemented __floordiv__ and truncate_divide methods in the BigDecimal struct to support floor division. [1] [2]

Enhancements to Rounding:

  • Introduced a new round function in src/decimojo/bigdecimal/rounding.mojo to handle rounding with different modes and precisions.
  • Added __round__ methods to the BigDecimal struct to support rounding with specified decimal places and rounding modes.

Improvements to Comparison Methods:

  • Removed the raises keyword from several comparison functions in src/decimojo/bigdecimal/comparison.mojo to simplify their signatures. [1] [2] [3]

Updates to Benchmarking Script:

  • Added a new benchmark for the round function in benches/bigdecimal/bench.mojo and updated the script to include the new benchmark. [1] [2] [3] [4]

Other Changes:

  • Updated the BigDecimal struct to implement additional traits and improved the scale_up_by_power_of_10 function in src/decimojo/biguint/arithmetics.mojo to handle non-positive values. [1] [2] [3] [4] [5]

These changes enhance the functionality and robustness of the BigDecimal library, making it more versatile and easier to use.

@forfudan forfudan merged commit eb95520 into main Apr 11, 2025
1 check passed
@forfudan forfudan deleted the round branch April 11, 2025 16:40
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