• Create BookmarkCreate Bookmark
• Create Note or TagCreate Note or Tag
• PrintPrint

### The Math Object

##### Table A.11. Math Methods and Attributes
NameMethod/AttributeFormatDescription
absMMath.abs(x)Computes the absolute value of x.
acosMMath.acos(x)Computes the arccosine of x.
asinMMath.asin(x)Computes the arcsine of x.
atanMMath.atan(x)Computes the arctangent of x.
atan2MMath.atan2(y, x)Computes the arctangent of the ratio y/x, that is, the angle from the positive x-axis to the point (x, y).
ceilMMath.ceil(x)Rounds x up to the nearest integer.
cosMMath.cos(x)Computes the cosine of x.
expMMath.exp(x)Computes Math.E to the power x.
floorMMath.floor(x)Rounds x down to the nearest integer.
logMMath.log(x)Computes the natural logarithm of x.
maxMMath.max(x, y)Returns the larger of integers x and y.
minMMath.min(x, y)Returns the smaller of integers x and y.
powMMath.pow(x, y)Computes x raised to the power y.
randomMMath.random()Returns a pseudo-random number between 0 and 1.
roundMMath.round(x)Rounds x to the nearest integer.
sinMMath.sin(x)Computes the sine of x.
sqrtMMath. sqrt(x)Computes the square root of x.
tanMMath.tan(x)Computes the tangent of x.
EAMath.EEuler's constant and the base of natural logarithms (approximately 2.718), traditionally notated as e.
LN2AMath.LN2The natural logarithm of 2 (approximately 0.693).
LOG2EAMath.LOG2EThe base 2 logarithm of Math.E (approximately 1.442).
LN10AMath.LN10The natural logarithm of 10 (approximately 2.302).
LOG10EAMath.LOG10EThe base 10 logarithm of Math.E (approximately 0.434).
PIAMath.PIThe ratio of the circumference of a circle to its diameter (approximately 3.14159).
SQRT1_2AMath.SQRT1_2The reciprocal of the square root of 2, that is, 1/Math.SQRT2 (approximately 0.707).
SQRT2MMath.SQRT2The square root of 2 (approximately 1.414).

PREVIEW

Not a subscriber?

Start A Free Trial

• Create BookmarkCreate Bookmark
• Create Note or TagCreate Note or Tag
• PrintPrint