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

Decimals being removed #49

Open
ShaunLWM opened this issue Apr 26, 2022 · 1 comment
Open

Decimals being removed #49

ShaunLWM opened this issue Apr 26, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ShaunLWM
Copy link

Please correct me if I'm wrong.
I realised the decimals are being chopped off when creating a new instance of a string and then converting it back to a string (with or without any additional methods used).

const price = "10.50";
console.log(price); // 10.50

const bn = new BN(price);
console.log(bn.toString(10)); // 10

const bn2 = new BN(price, 10);
console.log(bn2.toString(10)); // 10

 console.log(bn.mul(new BN(3)).toString(10)) // 30
@dani-z
Copy link

dani-z commented Nov 16, 2022

Hm I am gettings the same 🤔

@Montchy Montchy added the bug Something isn't working label Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants