开发者

Cross-Browser/Engine Math.PI is always 3.141592653589793?

just a re开发者_运维技巧ally random question but is the property Math.PI in javascript always 3.141592653589793 in every browser/engine?


I should hope so.

The ECMAScript Spec says:

15.8.1.6 PI

The Number value for π, the ratio of the circumference of a circle to its diameter, which is approximately 3.1415926535897932.


This is what the spec says about Math.PI:

The Number value for π, the ratio of the circumference of a circle to its diameter, which is approximately 3.1415926535897932.

Note that it says "approximately", which means it makes no guarantees about the exact value. However since numbers are required to use the standard IEEE 754 representation, you can expect most implementations to have a similar accuracy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜