Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request includes several changes to the Decimal type:

Code simplification and refactoring:

  • src/decimojo/decimal.mojo: Removed redundant comments and reorganized the docstring for the Decimal struct to improve clarity.
  • src/decimojo/decimal.mojo: Made Decimal a trivial type. Removed the __copyinit__ method.
  • src/decimojo/decimal.mojo: Removed several reverse arithmetic operation dunders (__radd__, __rsub__, __rmul__, __rtruediv__) for Float64 because it is not exact.
  • src/decimojo/decimal.mojo: Moved the string representation logic from the __str__ method to a new to_str method and added a to_str_scientific method for scientific notation.

Enhancements to rounding mode:

  • src/decimojo/rounding_mode.mojo: Added a docstring to the RoundingMode struct and included notes about the current workaround for defining custom enum-like classes in Mojo.

@forfudan forfudan merged commit c74f5d8 into main Mar 19, 2025
1 check failed
@forfudan forfudan deleted the str branch March 19, 2025 17:34
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