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

fix: pow operation in both rust and ts #572

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yanCode
Copy link
Contributor

@yanCode yanCode commented Oct 18, 2024

Problem

In rust and typescript/js, ^ is a bitwise operation of XOR, not exponentiation as intended. to correctly represents 10 tokens with 6 decimal places of percision, this fix has to be made, otherwise 10 * 10 ^ 6 would result in 98 in binary computation. not the expected 10 * 1_000_000, this might be misleading.

Summary of Changes

To fix 10 * 10 ^6:
in typescript the change is 10 * 10 ** 6,
while in rust it becomes 10 * 10u64.pow(6).

Fixes #

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