Skip to content

Conversation

@forfudan
Copy link
Owner

@forfudan forfudan commented Aug 3, 2025

This pull request focuses on improving the BigUInt and BigDecimal implementations in the decimojo library by enhancing precision, optimizing arithmetic operations, and ensuring consistency in handling zero values. It also includes a minor documentation update. Below is a categorized summary of the most important changes:

Zero words:

  • Update logic to ensure that there are no leading zero words in BigUInt by design. Add debug assert to check this.
  • Update is_zero() and comparison functions given that there are no leading zero words in BigUInt by design.

Bug Fix:

  • Fixed a syntax error in the extend_precision example in BigDecimal by correcting a missing closing quote.

Consistency Improvements:

  • Replaced instances of BigUInt() with BigUInt.ZERO for clearer intent when representing zero values across multiple functions.

Code Simplification and Optimization:

  • Replaced intermediate List[UInt32] allocations with direct BigUInt instantiations in arithmetic functions like add_slices_simd, subtract_school, and multiply_slices_school. This reduces unnecessary memory usage and improves performance.
  • Updated arithmetic methods to remove leading zero words after operations to ensure normalized results. This applies to addition, subtraction, and multiplication operations.

API Enhancements:

  • Introduced BigUInt.from_slice for copying slices of words, replacing manual slice handling in add_inplace_by_slice. This improves readability and reduces potential errors.

Documentation Update:

  • Added a link to the project's Discord channel in README.md for community engagement.

These changes collectively enhance the library's efficiency, maintainability, and usability.

@forfudan forfudan merged commit 43f7158 into main Aug 3, 2025
1 check passed
@forfudan forfudan deleted the work branch August 3, 2025 19:28
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