Closed rafael-lua closed 4 years ago
let x = new BigNumber('1111222233334444555566');
console.log(x.toExponential(4)); // '1.1112e+21'
console.log(x.toPrecision(5)); // '1.1112e+21'
console.log(x.precision(5).toString()); // '1.1112e+21'
@MikeMcl
Oh, thank you! And sorry for the obvious question.
Hello. I want to do the following:
In the readme example, the toString() method returned "1.111222233334444555566e+21". Is it possible to limit the amount of decimals so the value shown would be "1.1112e+21" instead?