[removed] PI (π) Calculator

前端 未结 5 1861
忘了有多久
忘了有多久 2021-01-26 04:43

Is there a way to calculate pi in Javascript? I know there you can use Math.PI to find pie like this:

var pie = Math.PI;
alert(pie); // output \"3.1         


        
5条回答
  •  误落风尘
    2021-01-26 05:15

    You can use this for your purpose

    Math.PI.toFixed(n)

    where n is the number of decimals you wish to display.

    It displays the rounded value of pi. It can be considered fairly correct upto 15 decimal places.

提交回复
热议问题