CS3 JS: Math

CS3 JavaScript

Math

 A global object containing a set of math functions and constants.

QuickLinks

abs, acos, asin, atan, atan2, ceil, cos, exp, floor, log, max, min, pow, random, round, sin, sqrt, tan

Properties

PropertyTypeAccessDescription
EnumberreadonlyEuler's constant and the base of natural logarithms. (default: 2.7182818284590452354)
LN10numberreadonlyThe natural logarithm of 10. (default: 2.302585092994046)
LN2numberreadonlyThe natural logarithm of 2. (default: 0.6931471805599453)
LOG10EnumberreadonlyThe base 10 logarithm of e. (default: 0.4342944819032518)
LOG2EnumberreadonlyThe base 2 logarithm of e. (default: 1.4426950408886934)
PInumberreadonlyThe ratio of the circumference of a circle to its diameter. (default: 3.14159265358979323846)
SQRT1_2numberreadonlyThe reciprocal of the square root of 1/2. (default: 0.7071067811865476)
SQRT2numberreadonlyThe square root of 2. (default: 1.4142135623730951)

Methods

number abs (x:number)
Returns the absolute value of a number.

ParameterTypeDescription
xnumberA number.

number acos (x:number)
Returns the arc cosine(in radians) of a number.

ParameterTypeDescription
xnumberA number.

number asin (x:number)
Returns the arc sin(in radians) of a number.

ParameterTypeDescription
xnumberA number.

number atan (x:number)
Returns the arc tangent(in radians) of a number.

ParameterTypeDescription
xnumberA number.

number atan2 (y:number, x:number)
Returns the arc tangent of the quotient of its arguments (y/x).

ParameterTypeDescription
ynumberA number.
xnumberA number.

number ceil (x:number)
Rounds the number up to the nearest integer.

ParameterTypeDescription
xnumberA number.

number cos (x:number)
Returns the cosine of an angle provided in radians.

ParameterTypeDescription
xnumberAn angle, in radians.

number exp (x:number)
Returns Math.E raised to the power of a number.

ParameterTypeDescription
xnumberA number.

number floor (x:number)
Rounds a number down to the nearest integer.

ParameterTypeDescription
xnumberA number.

number log (x:number)
Returns the natural logarithm of a number.

ParameterTypeDescription
xnumberA number.

number max (x:number, y:number)
Returns the maximum of two numbers.

ParameterTypeDescription
xnumber
ynumber

number min (x:number, y:number)
Returns the minimum of two numbers.

ParameterTypeDescription
xnumberNumbers.
ynumber

number pow (x:number, y:number)
Returns x raised to the power of y.

ParameterTypeDescription
xnumberNumbers.
ynumber

number random ()
Returns a pseudo-random number from 0.0 up to but not including 1.0.

number round (x:number)
Rounds a number to the nearest integer.

ParameterTypeDescription
xnumberA number.

number sin (x:number)
Returns the sine of an angle provided in radians.

ParameterTypeDescription
xnumberAn angle, in radians.

number sqrt (x:number)
Returns the square root of a number.

ParameterTypeDescription
xnumberA number.

number tan (x:number)
Returns the tangent of an angle provided in radians.

ParameterTypeDescription
xnumberAn angle, in radians.

Contents :: Index