Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request introduces significant updates to BigDecimal, BigInt, and BigUInt structures in the decimojo library. The changes add implicit constructors for better usability, refine initialization methods, and improve type handling for integral and floating-point scalars.

Enhancements to BigDecimal:

  • src/decimojo/bigdecimal/bigdecimal.mojo: Added implicit constructors for BigUInt, BigInt, Int, and integral scalars, enabling seamless initialization of BigDecimal objects from these types.
  • src/decimojo/bigdecimal/bigdecimal.mojo: Replaced the from_scalar method with from_integral_scalar and introduced from_float for better handling of integral and floating-point scalars. Improved constraints and error handling for scalar type validation. [1] [2]
  • src/decimojo/bigdecimal/bigdecimal.mojo: Added right-side arithmetic dunders (__radd__, __rsub__, etc.) for BigDecimal, enabling more flexible cross-type operations.

Enhancements to BigInt:

Minor Refinements:

These changes collectively improve the usability, readability, and robustness of the decimojo library, making it more intuitive for developers working with arbitrary-precision arithmetic.

@forfudan forfudan merged commit 81b523f into main Jun 30, 2025
1 check passed
@forfudan forfudan deleted the convert branch June 30, 2025 19:39
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