Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: new package support/i128 to manage 128-bit math #4809

Open
Shaptic opened this issue Mar 15, 2023 · 0 comments
Open

Feature request: new package support/i128 to manage 128-bit math #4809

Shaptic opened this issue Mar 15, 2023 · 0 comments

Comments

@Shaptic
Copy link
Contributor

Shaptic commented Mar 15, 2023

What problem does your feature solve?

Converting to/from integer types can be a huge source of bugs, and the use of xdr.Int128Parts will be prolific in the Soroban world as the de-facto way to represent amounts.

What would you like to see?

A new package, support/i128, that deals with everything 128-bit related. This (non-exhaustive) list includes:

  • doing math on the value
  • correctly representing negative values in the unsigned "halves" of the XDR struct
  • safely converting to/from int64 values which represent
  • conversions to/from strings with varying degrees of decimal precision/representation

It's likely that there are libraries out there we can leverage or at least borrow code from, but it will still need to be custom to some degree to adapt specifically to the xdr.Int128Parts structure.

What alternatives are there?

Chug along until it becomes a bigger problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant