Skip to content

[decimal] Implement a subtraction function for BigDecimal#67

Merged
forfudan merged 1 commit intomainfrom
dec
Mar 29, 2025
Merged

[decimal] Implement a subtraction function for BigDecimal#67
forfudan merged 1 commit intomainfrom
dec

Conversation

@forfudan
Copy link
Copy Markdown
Owner

This pull request includes several changes to the benches/bigdecimal/bench.mojo, mojoproject.toml, and src/decimojo/bigdecimal/arithmetics.mojo files to add new functionality and improve the codebase. The most important changes include adding a new subtraction benchmark, renaming benchmark commands, and implementing a subtraction function for BigDecimal.

New functionality:

  • Added a new subtraction benchmark by importing bench_bigdecimal_subtract and updating the benchmark commands in benches/bigdecimal/bench.mojo. [1] [2] [3]
  • Implemented the subtract function for BigDecimal in src/decimojo/bigdecimal/arithmetics.mojo, including handling zero operands and ensuring operands have the same scale.

Codebase improvements:

  • Renamed benchmark commands in mojoproject.toml for consistency and clarity.
  • Added notes to the add function in src/decimojo/bigdecimal/arithmetics.mojo to clarify its behavior and result properties.
  • Added the __sub__ method to the BigDecimal struct in src/decimojo/bigdecimal/bigdecimal.mojo to support subtraction using the new subtract function.

@forfudan forfudan merged commit 7489776 into main Mar 29, 2025
1 check passed
@forfudan forfudan deleted the dec branch March 29, 2025 11:51
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.

1 participant