## Posted By

mlange on 10/03/06

## Who likes this?

2 people have marked this snippet as a favorite

# Math functions

/ Published in: JavaScript

`Math.abs(n)	// Returns the absolute value of nMath.acos(n)	// Returns (in radians) cos-1 of nMath.asin(n)	// Returns (in radians) sin-1 of nMath.atan(n)	// Returns (in radians) tan-1 of nMath.atan2(n,k)	// Returns the angle (rads) from cartesian coordinates 0,0 to n,kMath.ceil(n)	// Returns n rounded up to the nearest whole numberMath.cos(n)	// Returns cos n (where n is in radians)Math.exp(n)	// Returns enMath.floor(n)	// Returns n rounded down to the nearest whole numberMath.log(n)	// Returns ln(n)// Note, to find log10(n), use Math.log(n) / Math.log(10)Math.max(a,b,c,...)	// Returns the largest numberMath.min(a,b,c,...)	Returns the smallest numberMath.pow(n,k)	// Returns n^kMath.random()	// Returns a random number between 0 and 1Math.round(n)	// Returns n rounded up or down to the nearest whole numberMath.sin(n)	// Returns sin n (where n is in radians)Math.sqrt(n)	// Returns the square root of nMath.tan(n)	// Returns tan n (where n is in radians)`