Running Math.PI.toString(10)
in various JS engines seems to consistently output "3.141592653589793"
, which has 16 significant digits. Some other examples with 16 significant digits, tested in Chrome:
(Math.PI * 10).toString(10); // "31.41592653589793"
(Math.PI * 100).toString(10); // "314.1592653589793"
(Math.PI / 10000000).toString(10); // "3.141592653589793e-7"
However:
(Math.PI * 10000).toString(10); // "31415.926535897932"
(Math.PI / 100).toString(10); // "0.031415926535897934"
Is this standardized, or left to each engine to decide? What does the standard say?