`
samsongbest
  • 浏览: 163728 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Math函数

 
阅读更多

Math.pow(2,53)         // => 9007199254740992: 2 to the power 53
Math.round(.6)         // => 1.0: round to the nearest integer
Math.ceil(.6)         // => 1.0: round up to an integer
Math.floor(.6)         // => 0.0: round down to an integer
Math.abs(-5)         // => 5: absolute value
Math.max(x,y,z)     // Return the largest argument
Math.min(x,y,z)     // Return the smallest argument
Math.random()         // Pseudo-random number x where 0 <= x < 1.0
Math.PI         // π: circumference of a circle / diameter
Math.E             // e: The base of the natural logarithm
Math.sqrt(3)         // The square root of 3
Math.pow(3, 1/3)     // The cube root of 3
Math.sin(0)         // Trigonometry: also Math.cos, Math.atan, etc.
Math.log(10)         // Natural logarithm of 10
Math.log(100)/Math.LN10 // Base 10 logarithm of 100
Math.log(512)/Math.LN2     // Base 2 logarithm of 512
Math.exp(3)         // Math.E cubed

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics