Skip to content

Instantly share code, notes, and snippets.

@psiborg
Created January 6, 2012 08:25
Show Gist options
  • Select an option

  • Save psiborg/1569679 to your computer and use it in GitHub Desktop.

Select an option

Save psiborg/1569679 to your computer and use it in GitHub Desktop.
JS Math
Math.PI // 3.141592653589793
Math.E // 2.718281828459045
Math.LN10 // 2.302585092994046
Math.LN2 // 0.6931471805599453
Math.LOG10E // 0.4342944819032518
Math.LOG2E // 1.4426950408889634
Math.SQRT1_2 // 0.7071067811865476
Math.SQRT2 // 1.4142135623730951
Math.random() // returns a number between 0 and 1
Math.exp()
Math.pow()
Math.log()
Math.cos()
Math.sin()
Math.tan()
Math.acos()
Math.asin()
Math.atan()
Math.atan2()
Math.abs(x)
Math.round(x)
Math.ceil(x)
Math.floor(x) // "integer" method
Math.min(x, y, ...)
Math.max(x, y, ...)
Math.sqrt(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment