Open ShaunLWM opened 2 years ago
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
Hm I am gettings the same 🤔
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).