Math object

The Math object allows you to perform advanced mathematical operations. This object is always available in a form of predefined Math global variable.

// calculate sine of 90 degrees
var Sine90 = Math.Sin(90);


Methods

Abs Returns the absolute value of a number
Acos Returns the arccosine of a number
Asin Returns the arcsine of a number
Atan Returns the arctangent of a number
Atan2 Returns the angle (in radians) from the X axis to a point (y,x)
Ceil Returns the smallest integer greater than or equal to the specified number
Cos Returns the cosine of a number
Cosh Returns the hyperbolic cosine of a number
Exp Returns e (the base of natural logarithms) raised to a power
Floor Returns the greatest integer less than or equal to the specified number
Log Returns the natural logarithm of a number
Log10 Returns the base-10 logarithm of a number
Pow Returns the value of a Base value taken to a specified power
Sin Returns the sine of a number
Sinh Returns the hyperbolic sine of a number
Tan Returns the tangent of a number
Tanh Returns the hyperbolic tangent of a number
Sqrt Returns the square root of a number
DegToRad Converts an angle from degrees to radians
RadToDeg Converts an angle from radians to degrees

Attributes

Type (read only) Returns always "math"
PI (read only) Returns the ratio of the circumference of a circle to its diameter, approximately 3.141592653589793

Abs(Number)

Returns the absolute value of a number


Acos(Number)

Returns the arccosine of a number


Asin(Number)

Returns the arcsine of a number


Atan(Number)

Returns the arctangent of a number


Atan2(Y, X)

Returns the angle (in radians) from the X axis to a point (y,x)

Parameters

X
A number representing the cartesian x-coordinate
Y
A number representing the cartesian y-coordinate

Ceil(Number)

Returns the smallest integer greater than or equal to the specified number


Cos(Angle)

Returns the cosine of a number

Parameters

Angle
Angle in degrees

Cosh(Angle)

Returns the hyperbolic cosine of a number

Parameters

Angle
Angle in degrees

Exp(Number)

Returns e (the base of natural logarithms) raised to a power


Floor(Number)

Returns the greatest integer less than or equal to the specified number


Log(Number)

Returns the natural logarithm of a number


Log10(Number)

Returns the base-10 logarithm of a number


Pow(Base, Exponent)

Returns the value of a Base value taken to a specified power


Sin(Angle)

Returns the sine of a number

Parameters

Angle
Angle in degrees

Sinh(Angle)

Returns the hyperbolic sine of a number

Parameters

Angle
Angle in degrees

Tan(Angle)

Returns the tangent of a number

Parameters

Angle
Angle in degrees

Tanh(Angle)

Returns the hyperbolic tangent of a number

Parameters

Angle
Angle in degrees

Sqrt(Number)

Returns the square root of a number


DegToRad(Angle)

Converts an angle from degrees to radians

Parameters

Angle
Angle to convert (in degrees)

Return value

Returns the converted angle (in radians)


RadToDeg(Angle)

Converts an angle from radians to degrees

Parameters

Angle
Angle to convert (in radians)

Return value

Returns the converted angle (in degrees)