Add fixed-point signedness conversions#1565
Merged
Merged
Conversation
|
This was referenced Apr 24, 2026
Merged
Member
Author
This was referenced Apr 24, 2026
Merged
BundleMonFiles updated (4)
Unchanged files (143)
Total files change +424B +0.08% Final result: ✅ View report in BundleMon website ➡️ |
Contributor
|
Documentation Preview: https://kit-docs-o4qm014dn-anza-tech.vercel.app |
9c46f45 to
8bf3cec
Compare
8f082ee to
1c4daf3
Compare
8bf3cec to
c6632eb
Compare
1c4daf3 to
4b948f4
Compare
c6632eb to
ee95d1e
Compare
6f3f11e to
8b6f61d
Compare
ee95d1e to
7f3f585
Compare
8b6f61d to
e909cdc
Compare
7f3f585 to
6d7ffb1
Compare
Member
Author
Merge activity
|
e909cdc to
677b092
Compare
6d7ffb1 to
31b5913
Compare
677b092 to
6b3accc
Compare
31b5913 to
441605a
Compare
This PR adds four helpers to `@solana/fixed-points` for converting between signed and unsigned variants at the same `totalBits` and scale: `toSignedBinaryFixedPoint`, `toUnsignedBinaryFixedPoint`, `toSignedDecimalFixedPoint`, and `toUnsignedDecimalFixedPoint`. Each helper accepts input of either signedness. If the input already has the target signedness, the same reference is returned — no new object is allocated. Otherwise the raw value is checked against the target range and a new frozen value is returned with the updated `signedness` field. Values that do not fit the target range (for example a negative number being converted to unsigned, or an unsigned value above `2 ** (totalBits - 1) - 1` being converted to signed) throw the existing `SOLANA_ERROR__FIXED_POINTS__VALUE_OUT_OF_RANGE` error. No new error codes were introduced.
6b3accc to
42010c9
Compare
Contributor
|
🔎💬 Inkeep AI search and chat service is syncing content for source 'Solana Kit Docs' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR adds four helpers to
@solana/fixed-pointsfor converting between signed and unsigned variants at the sametotalBitsand scale:toSignedBinaryFixedPoint,toUnsignedBinaryFixedPoint,toSignedDecimalFixedPoint, andtoUnsignedDecimalFixedPoint.Each helper accepts input of either signedness. If the input already has the target signedness, the same reference is returned — no new object is allocated. Otherwise the raw value is checked against the target range and a new frozen value is returned with the updated
signednessfield. Values that do not fit the target range (for example a negative number being converted to unsigned, or an unsigned value above2 ** (totalBits - 1) - 1being converted to signed) throw the existingSOLANA_ERROR__FIXED_POINTS__VALUE_OUT_OF_RANGEerror. No new error codes were introduced.