Functions -
math
absFloat |
Calculates the absolute value of a float value.
|
absInt |
Calculates the absolute value of an int value.
|
acos |
Calculates the arc cosine of a value; the returned angle is in the range 0.
|
asin |
Calculates the arc sine of a value.
|
atan |
Calculates the arc tangent of a value.
|
atan2 |
Calculates the angle theta from the conversion of rectangular coordinates (a, b) to polar coordinates (r, theta).
|
cbrt |
Calculates the cube root of a float value.
|
ceil |
Calculates the smallest (closest to negative infinity) double value that is greater than or equal to the argument and
is equal to a mathematical integer.
|
copySign |
Calculates the first floating-point argument with the sign of the second floating-point argument.
|
cos |
Calculates the trigonometric cosine of an angle.
|
cosh |
Calculates the hyperbolic cosine of a float value.
|
exp |
Calculates Euler's number, that is 'e' raised to the power of exponent.
|
expm1 |
Calculates (e to the power of x) -1.
|
floor |
Calculates the largest (closest to positive infinity) float value that is less than or equal to the argument and is
equal to a mathematical integer.
|
floorDiv |
Calculates the largest (closest to positive infinity) int value that is less than or equal to the algebraic quotient.
|
floorMod |
Calculates the floor modulus of the long arguments.
|
getExponent |
Calculates the unbiased exponent used in the representation of a float.
|
hypot |
Calculates sqrt(a squared +b squared) without intermediate overflow or underflow.
|
log |
Calculates the natural logarithm (base e) of a float value.
|
log10 |
Calculates the base 10 logarithm of a float value.
|
log1p |
Calculates the natural logarithm of the sum of the argument and 1.
|
negateExact |
Calculates the negation of the argument.
|
nextAfter |
Calculates the floating-point number adjacent to the first argument in the direction of the second argument.
|
nextDown |
Calculates the adjacent floating-point value closer to negative infinity.
|
nextUp |
Calculates the adjacent floating-point value closer to positive infinity.
|
pow |
Calculates the value of the 'a' raised to the power of 'b'.
|
random |
Selects a random number between 0.
|
randomInRange |
Selects a random number between the given start(inclusive) and end(exclusive) values.
|
remainder |
Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
|
rint |
Calculates the double value that is closest in value to the argument and is equal to a mathematical integer.
|
round |
Calculates the closest int to the argument, with ties rounding to positive infinity.
|
scalb |
Calculates a × (2 to the power of b) rounded as if performed by a single correctly rounded floating-point
multiply to a member of the float value set.
|
signum |
Calculates the signum function of the argument.
|
sin |
Calculates the trigonometric sine of an angle.
|
sinh |
Calculates the hyperbolic sine of a float value.
|
sqrt |
Calculates rounded positive square root of the given value.
|
tan |
Calculates the trigonometric tangent of an angle.
|
tanh |
Calculates the hyperbolic tangent of a double value.
|
toDegrees |
Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
|
toRadians |
Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
|
ulp |
Returns the size of an ulp of the argument.
|
float absoluteFloatValue = math:absFloat(-152.2544);
Parameters
- val float
-
Value to get absolute value
-
Return Type
(float) Calculated absolute value
int absoluteIntValue = math:absInt(-152);
Parameters
- val int
-
Value to get the absolute value
-
Return Type
(int) Calculated absolute value
float acosValue = math:acos(0.027415567780803774);
Parameters
- val float
-
Value to get the arc cosine
-
Return Type
(float) Calculated arc cosine value
float arcSineValue = math:asin(0.027415567780803774);
Parameters
- val float
-
Value to get the arc sine
-
Return Type
(float) Calculates arc sine value
float arcTangent = math:atan(0.027415567780803774);
Parameters
- val float
-
Value to get the arc tangent
-
Return Type
(float) Calculated arc tangent value
float arcTangentFromCoordinates = math:atan2(6.4, 3.2);
Parameters
- a float
-
Ordinate coordinate
- b float
-
Abscissa coordinate
-
Return Type
(float) Calculated angle theta
float cubeRoot = math:cbrt(-27.0);
Parameters
- val float
-
Value to get the cube root
-
Return Type
(float) Calculated cube root value
float ceilingValue = math:ceil(6.4);
Parameters
- val float
-
Value to get the ceil
-
Return Type
(float) Calculated smallest double value
float copySignValue = math:copySign(6.4, 2.4);
Parameters
- a float
-
Parameter providing the magnitude of the result
- b float
-
Parameter providing the sign of the result
-
Return Type
(float) Calculated floating-point argument
float cosineValue = math:cos(0.3124);
Parameters
- val float
-
Value to get the trigonometric cosine
-
Return Type
(float) Calculated cosine value
float hyperbolicCosineValue = math:cosh(0.3124);
Parameters
- val float
-
Number whose hyperbolic cosine is to be returned
-
Return Type
(float) Calculated hyperbolic cosine of given float value
float euler = math:exp(3.2);
Parameters
- val float
-
Exponential value to raise
-
Return Type
(float) Calculated exponential value
float exponentValue = math:expm1(6.4);
Parameters
- val float
-
Exponent to raise e to in the computation
-
Return Type
(float) Calculated result
float floorValue = math:floor(6.4);
Parameters
- val float
-
A float value
-
Return Type
(float) Calculated float value
int|error floorDivValue = math:floorDiv(6, 4);
Parameters
- a int
-
Dividend
- b int
-
Divisor
-
Return Type
(int | Error) Calculated int value or else
Error
if b is 0
int|error floorModulesValue = math:floorMod(6, 4);
Parameters
- a int
-
dividend
- b int
-
divisor
-
Return Type
(int | Error) Calculated floor modulus or else
Error
if b is 0
int unbiasedExponentValue = math:getExponent(6.4);
Parameters
- val float
-
Float value
-
Return Type
(int) Calculated unbiased exponent of the argument
float pythogarusValue = math:hypot(6.4, 3.6);
Parameters
- a float
-
Float value
- b float
-
Float value
-
Return Type
(float) Calculated square root value
float logarithmValue = math:log(6.4);
Parameters
- val float
-
A float value
-
Return Type
(float) Calculated natural logarithm value
float logarithmValueBaseTen = math:log10(6.4);
Parameters
- val float
-
A float value
-
Return Type
(float) Calculated base 10 logarithm of a given float value
float naturalLogarithmValue = math:log1p(6.4);
Parameters
- val float
-
A float value
-
Return Type
(float) Calculated natural log of x + 1
int|error negationValue = math:negateExact(6);
Parameters
- val int
-
value to negate
-
Return Type
(int | Error) Calculated negation value or else
Error
if overflow occurred
float nextAfterValue = math:nextAfter(6.4, 3.4);
Parameters
- a float
-
Starting floating-point value
- b float
-
Value indicating which of start's neighbors or start should be returned
-
Return Type
(float) Calculated floating-point number
float nextDownValue = math:nextDown(6.4);
Parameters
- val float
-
Starting floating-point value
-
Return Type
(float) Calculated floating-point value
float nextUpValue = math:nextUp(6.4);
Parameters
- val float
-
Starting floating-point value
-
Return Type
(float) Calculates floating-point value
float aPowerB = math:pow(3.2, 2.4);
Parameters
- a float
-
Base value
- b float
-
Exponential value
-
Return Type
(float) Calculated exponential value
float randomValue = math:random();
-
Return Type
(float) Selected random value
int|error randomInteger = math:randomInRange(1, 100);
Parameters
- startRange int
-
Range start value
- endRange int
-
Range end value
-
Return Type
(int | Error) Selected random value or else
Error
if start range is greater than the end range
float remainderValue = math:remainder(6.4, 3.6);
Parameters
- a float
-
dividend
- b float
-
divisor
-
Return Type
(float) Computed remainder when a is divided by b
float roundedValue = math:rint(6.4);
Parameters
- val float
-
A float value
-
Return Type
(float) Calculated double value
int roundedIntegerValue = math:round(6.4);
Parameters
- val float
-
A floating-point value to be rounded to an integer
-
Return Type
(int) Calculated value of the argument rounded to the nearest int value
float scalbValue = math:scalb(6.4, 2);
Parameters
- a float
-
Number to be scaled by a power of two
- b int
-
Power of 2 used to scale a
-
Return Type
(float) Calculated result
float signumValue = math:signum(6.4);
Parameters
- val float
-
floating-point value whose signum is to be returned
-
Return Type
(float) Calculated signum function of the argument
float sineValue = math:sin(0.96);
Parameters
- val float
-
An angle, in radians
-
Return Type
(float) Calculated sine of the argument
float hyperbolicSineValue = math:sinh(0.96);
Parameters
- val float
-
Number whose hyperbolic sine is to be returned
-
Return Type
(float) Calculated hyperbolic sine of a given float
float squareRoot = math:sqrt(6.4);
Parameters
- val float
-
Value to get square root
-
Return Type
(float) Calculated square root value
float tanValue = math:tan(0.96);
Parameters
- val float
-
An angle, in radians
-
Return Type
(float) Calculated tangent of the argument
float hyperbolicTanValue = math:tanh(0.96);
Parameters
- val float
-
Number whose hyperbolic tangent is to be returned
-
Return Type
(float) Calculated hyperbolic tangent of x
float angleValueInDegrees = math:toDegrees(0.96);
Parameters
- val float
-
An angle, in radians
-
Return Type
(float) Measurement of the angle angrad in degrees
float angleValueInRadians = math:toRadians(0.96);
Parameters
- val float
-
An angle, in degrees
-
Return Type
(float) Measurement of the angle angdeg in radians