I have to create a JavaScript Number containing 17 decimal places. I used the following code :
var integerPart = "10";
var roundedDigits = "12345678912345678";
var x = Number(integerPart + '.' + roundedDigits);
Output: 10.123456789123457
But when I try to output this number object, I get max of 15 decimal places. How can I achieve this?
all numbers in javascript are double. they have a maximum of 16 digits. you need a special datatype like BigDecimal
see this answer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.