Math
Module | ejs |
Definition | class Math |
Inheritance | Math ![]() |
Stability | Evolving. |
The Math class provides a set of static methods for performing common arithmetic, exponential and trigonometric functions.
It also provides commonly used constants such as PI. See also the Number class. Depending on the method and the supplied argument, return values may be real numbers, NaN (not a number) or positive or negative infinity.
Properties
Qualifiers | Property | Type | Description |
---|---|---|---|
static const | E | Number | Base of natural logarithms (Euler's number). |
static const | LN10 | Number | Natural log of 10. |
static const | LN2 | Number | Natural log of 2. |
static const | LOG10E | Number | Base 10 log of e. |
static const | LOG2E | Number | Base 2 log of e. |
static const | PI | Number | The ratio of the circumference to the diameter of a circle. |
static const | SQRT1_2 | Number | Reciprocal of the square root of 2. |
static const | SQRT2 | Number | Square root of 2. |
Math Class Methods
Qualifiers | Method |
---|---|
static | abs(value: Number): Number |
Returns the absolute value of a number (which is equal to its magnitude). | |
static | acos(angle: Number): Number |
Calculates the arc cosine of an angle (in radians). | |
static | asin(oper: Number): Number |
Calculates the arc sine of an angle (in radians). | |
static | atan(oper: Number): Number |
Calculates the arc tangent of an angle (in radians). | |
static | atan2(y: Number, x: Number): Number |
Calculates the arc tangent of the quotient of its arguments. | |
static | ceil(oper: Number): Number |
Return the smallest integer greater then this number. | |
static | cos(angle: Number): Number |
Calculates the cosine of an angle (in radians). | |
static | exp(power: Number): Number |
Calculate E to the power of the argument. | |
static | floor(oper: Number): Number |
Returns the largest integer smaller then the argument. | |
static | log(oper: Number): Number |
Calculates the natural log (ln) of a number. | |
static | log10(oper: Number): Number |
Calculates the log (base 10) of a number. | |
static | max(x: Number, y: Number): Number |
Returns the greater of the number or the argument. | |
static | min(x: Number, y: Number): Number |
Returns the lessor of the number or the argument. | |
static | pow(num: Number, pow: Number): Number |
Returns a number which is equal to this number raised to the power of the argument. | |
static | random(): Number |
Generates a random number (a Number) inclusively between 0.0 and 1.0. | |
static | round(num: Number): Number |
Round this number down to the closes integral value. | |
static | sin(angle: Number): Number |
Calculates the sine of an angle (in radians). | |
static | sqrt(oper: Number): Number |
Calculates the square root of a number. | |
static | tan(angle: Number): Number |
Calculates the tangent of an angle (in radians). |
Math Instance Methods
Qualifiers | Method |
---|
Method Detail
- Description
- Returns the absolute value of a number (which is equal to its magnitude).
- Parameters
value: Number Number value to examine.
- Returns
- The absolute value.
- Description
- Calculates the arc cosine of an angle (in radians).
- Parameters
angle: Number In radians.
- Returns
- The arc cosine of the argument.
- Description
- Calculates the arc sine of an angle (in radians).
- Parameters
oper: Number The operand.
- Returns
- The arc sine of the argument.
- Description
- Calculates the arc tangent of an angle (in radians).
- Parameters
oper: Number The operand.
- Returns
- The arc tanget of the argument.
- Description
- Return the smallest integer greater then this number.
- Returns
- The ceiling.
- Description
- Calculates the cosine of an angle (in radians).
- Parameters
angle: Number In radians.
- Returns
- The cosine of the argument.
- Description
- Returns the largest integer smaller then the argument.
- Parameters
oper: Number The operand.
- Returns
- The floor.
- Description
- Calculates the natural log (ln) of a number.
- Parameters
oper: Number The operand.
- Returns
- The natural log of the argument.
- Description
- Calculates the log (base 10) of a number.
- Parameters
oper: Number The operand.
- Returns
- The base 10 log of the argument.
- Specified
- ejscript-2.5
static random(): Number
- Description
- Generates a random number (a Number) inclusively between 0.0 and 1.0.
- Returns
- A random number.
- Description
- Round this number down to the closes integral value.
- Parameters
num: Number Number to round.
- Returns
- A rounded number.
- Description
- Calculates the sine of an angle (in radians).
- Parameters
angle: Number In radians.
- Returns
- The sine of the argument.
- Description
- Calculates the square root of a number.
- Parameters
oper: Number The operand.
- Returns
- The square root of the argument.
- Description
- Calculates the tangent of an angle (in radians).
- Parameters
angle: Number In radians.
- Returns
- The tangent of the argument.