Skip to content

[decimojo] Use bitcast() for coefficient()#19

Merged
forfudan merged 1 commit intomainfrom
work
Mar 8, 2025
Merged

[decimojo] Use bitcast() for coefficient()#19
forfudan merged 1 commit intomainfrom
work

Conversation

@forfudan
Copy link
Copy Markdown
Owner

@forfudan forfudan commented Mar 8, 2025

This pull request includes a significant improvement to the coefficient method in the Decimal struct within the src/decimojo/decimal.mojo file. The changes aim to enhance performance by using a faster bitcast implementation.

Enhancements to coefficient method:

  • Updated the method documentation to include code formatting for better readability.
  • Implemented a fast version of the coefficient method using bitcast to directly convert the three 32-bit parts to a UInt128, given little-endian memory order.
  • Commented out the previous arithmetic implementation of combining the three 32-bit parts into a single Int128, retaining it as an alternative.

@forfudan forfudan merged commit d20bc32 into main Mar 8, 2025
2 checks passed
@forfudan forfudan deleted the work branch March 8, 2025 13:02
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