How can pi be calculated to a set number of digits in PHP?

前端 未结 4 692
逝去的感伤
逝去的感伤 2021-01-05 11:18

How can I calculate the value of pi in PHP up to X decimal numbers.

4 decimal points

3.141

64 d

4条回答
  •  被撕碎了的回忆
    2021-01-05 11:44

    Calculating PI in php?

    Why calculate when we already have the M_PI constant?

    M_PI contains the value 3.14159265358979323846.

    10000 decimal places for PI is quite a number.

    See: http://www.php.net/manual/en/math.constants.php

提交回复
热议问题