Posted By

mlange on 10/03/06


Tagged

Maths


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

rnrleachryan
vali29


Math functions


 / Published in: JavaScript
 

  1. Math.abs(n) // Returns the absolute value of n
  2. Math.acos(n) // Returns (in radians) cos-1 of n
  3. Math.asin(n) // Returns (in radians) sin-1 of n
  4. Math.atan(n) // Returns (in radians) tan-1 of n
  5. Math.atan2(n,k) // Returns the angle (rads) from cartesian coordinates 0,0 to n,k
  6. Math.ceil(n) // Returns n rounded up to the nearest whole number
  7. Math.cos(n) // Returns cos n (where n is in radians)
  8. Math.exp(n) // Returns en
  9. Math.floor(n) // Returns n rounded down to the nearest whole number
  10. Math.log(n) // Returns ln(n)
  11. // Note, to find log10(n), use Math.log(n) / Math.log(10)
  12. Math.max(a,b,c,...) // Returns the largest number
  13. Math.min(a,b,c,...) Returns the smallest number
  14. Math.pow(n,k) // Returns n^k
  15. Math.random() // Returns a random number between 0 and 1
  16. Math.round(n) // Returns n rounded up or down to the nearest whole number
  17. Math.sin(n) // Returns sin n (where n is in radians)
  18. Math.sqrt(n) // Returns the square root of n
  19. Math.tan(n) // Returns tan n (where n is in radians)

Report this snippet  

You need to login to post a comment.