The maximum decimal places in javascript is limited to 15
.
So you cannot get more than 15 decimal places.
But you can get up to 20 decimal places by doing but its not accurate
Math.PI.toFixed(20); //3.14159265358979311600
That will give you a PI value with 20 decimal places.
Note: 20
is the maximum and 0
is the minimum for toFixed()
.
So trying Math.PI.toFixed(100)
will throw an error.