Open Aursen opened 7 months ago
The changes introduce a conversion implementation from FPDecimal
to Uint256
in the fp_decimal
module. This addition simplifies the process of converting between these types, particularly useful in macros. A corresponding test ensures the correctness of this new feature.
File Path | Change Summary |
---|---|
packages/injective-math/src/fp_decimal/... | Added impl From<FPDecimal> for Uint256 and a test function test_into_u256() for this conversion. |
sequenceDiagram
participant Client
participant FPDecimal
participant Uint256
Client->>FPDecimal: Create FPDecimal instance
Client->>Uint256: Convert FPDecimal to Uint256 using From trait
Uint256-->>Client: Return Uint256 instance
Objective | Addressed | Explanation |
---|---|---|
Implement the trait From<FPDecimal> for Uint256 (Issue #216) |
✅ | |
Ensure conversion correctness with a test function (Issue #216) | ✅ |
In code's vast and endless sea,
A decimal finds its way to be,
From floating points to numbers grand,
Uint256 now close at hand.
With tests to guide and keep it true,
Our macros cheer, a job well due.
🎉✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Hi @Aursen it'd be good if you added some test cases for this prior to merging.
Hi @Aursen it'd be good if you added some test cases for this prior to merging.
Yeah sure let me add it
Closes #216
Summary by CodeRabbit
New Features
FPDecimal
toUint256
for improved compatibility.Tests
FPDecimal
toUint256
.