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 |
---|---|---|---|
public static const | E | Number | Base of natural logarithms (Euler's number). |
public static const | LN10 | Number | Natural log of 10. |
public static const | LN2 | Number | Natural log of 2. |
public static const | LOG10E | Number | Base 10 log of e. |
public static const | LOG2E | Number | Base 2 log of e. |
public static const | PI | Number | The ratio of the circumference to the diameter of a circle. |
public static const | SQRT1_2 | Number | Reciprocal of the square root of 2. |
public static const | SQRT2 | Number | Square root of 2. |
Math Methods
Qualifiers | Method |
---|---|
public static | abs(value: Number): Number |
Returns the absolute value of a number (which is equal to its magnitude). | |
public static | acos(angle: Number): Number |
Calculates the arc cosine of an angle (in radians). | |
public static | asin(oper: Number): Number |
Calculates the arc sine of an angle (in radians). | |
public static | atan(oper: Number): Number |
Calculates the arc tangent of an angle (in radians). | |
public static | atan2(y: Number, x: Number): Number |
Calculates the arc tangent of the quotient of its arguments. | |
public static | ceil(oper: Number): Number |
Return the smallest integer greater then this number. | |
public static | cos(angle: Number): Number |
Calculates the cosine of an angle (in radians). | |
public static | exp(power: Number): Number |
Calculate E to the power of the argument. | |
public static | floor(oper: Number): Number |
Returns the largest integer smaller then the argument. | |
public static | log(oper: Number): Number |
Calculates the natural log (ln) of a number. | |
public static | log10(oper: Number): Number |
Calculates the log (base 10) of a number. | |
public static | max(x: Number, y: Number): Number |
Returns the greater of the number or the argument. | |
public static | min(x: Number, y: Number): Number |
Returns the lessor of the number or the argument. | |
public static | pow(num: Number, pow: Number): Number |
Returns a number which is equal to this number raised to the power of the argument. | |
public static | random(): Number |
Generates a random number (a Number) inclusively between 0.0 and 1.0. | |
public static | round(num: Number): Number |
Round this number down to the closes integral value. | |
public static | sin(angle: Number): Number |
Calculates the sine of an angle (in radians). | |
public static | sqrt(oper: Number): Number |
Calculates the square root of a number. | |
public static | tan(angle: Number): Number |
Calculates the tangent of an angle (in radians). |
Method Detail
Returns the absolute value of a number (which is equal to its magnitude).
- Parameters
value: Number Number value to examine.
- Returns
- The absolute value.
Calculates the arc cosine of an angle (in radians).
- Parameters
angle: Number In radians.
- Returns
- The arc cosine of the argument.
Calculates the arc sine of an angle (in radians).
- Parameters
oper: Number The operand.
- Returns
- The arc sine of the argument.
Calculates the arc tangent of an angle (in radians).
- Parameters
oper: Number The operand.
- Returns
- The arc tanget of the argument.
Return the smallest integer greater then this number.
- Returns
- The ceiling.
Calculates the cosine of an angle (in radians).
- Parameters
angle: Number In radians.
- Returns
- The cosine of the argument.
Returns the largest integer smaller then the argument.
- Parameters
oper: Number The operand.
- Returns
- The floor.
Calculates the natural log (ln) of a number.
- Parameters
oper: Number The operand.
- Returns
- The natural log of the argument.
Calculates the log (base 10) of a number.
- Parameters
oper: Number The operand.
- Returns
- The base 10 log of the argument.
- Specified
- ejscript-1.1
Generates a random number (a Number) inclusively between 0.0 and 1.0.
- Returns
- A random number.
Round this number down to the closes integral value.
- Parameters
num: Number Number to round.
- Returns
- A rounded number.
Calculates the sine of an angle (in radians).
- Parameters
angle: Number In radians.
- Returns
- The sine of the argument.
Calculates the square root of a number.
- Parameters
oper: Number The operand.
- Returns
- The square root of the argument.
Calculates the tangent of an angle (in radians).
- Parameters
angle: Number In radians.
- Returns
- The tangent of the argument.