Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> JavaScript >> Snippet

18 Math


Math object provides common constants as well as mathematical formulas.

Constants :
Math .E   //Base of natural logarithms
Math .LN2  //Natural log of 2
Math .LN10  //Natural log of 10
Math .LOG2E  //Base 2 log of e
Math .LOG10E  //Base 10 log of e
Math .PI   //Ratio of circle circumference to its radius (pi)
Math .SQRT2  //Square root of 2

Formulas / Equations :
Math .abs()
Math .acos()
Math .asin()
Math .atan()
Math .atan2()
Math .ceil()
Math .exp()
Math .floor()
Math .log()
Math .max()
Math .min()
Math .pow()
Math .random()
Math .round()
Math .sin()
Math .sqrt()
Math .tan()

If a string is supplied where a number is needed, JavaScript attempts to convert the string to a number.