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

Add "divide" and "multiple" to Uint64 #780

Open
fboucquez opened this issue May 7, 2021 · 0 comments
Open

Add "divide" and "multiple" to Uint64 #780

fboucquez opened this issue May 7, 2021 · 0 comments
Labels
P3 Issue Low severity cosmetic issues with minor inconvenience

Comments

@fboucquez
Copy link
Contributor

fboucquez commented May 7, 2021

Atm, the way we convert from an absolute value to a relative value is using:

const relative = absoluteUint64.compact() / Math.pow(10, config.tokenDivisibility);

The absoluteUint64.compact() may fail if the absoluteUint64 is >= 2^53.

The compact is used because our native UInt64 doesn't have natives division or multiplication like we do have addition and subtraction.

Question, the TS SDK has a dependency to the "long" package.

https://github.com/nemtech/symbol-sdk-typescript-javascript/blob/main/package.json#L109

https://www.npmjs.com/package/long

Should we use the library instead of having our own custom Uint64? Why using both RawUInt64 and Long?

@fboucquez fboucquez added the P3 Issue Low severity cosmetic issues with minor inconvenience label May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Issue Low severity cosmetic issues with minor inconvenience
Projects
None yet
Development

No branches or pull requests

1 participant