Math
Library of mathematical functions.
Functions
Abs
Returns the absolute value by discarding sign of a numeric expression. Results are greater or equal to 0.
Math.Abs(value: number)
Parameters
value
: The value on which the absolute value is computed.
Returns
number
: The absolute value of the input.
Math.Abs(1)
// Result:
// 1
Math.Abs(-1)
// Result:
// 1
Math.Abs(0.0)
// Result:
// 0.0
Math.Abs(-1.2)
// Result:
// 1.2
Acos
Arcosine, returns the angle in radians which cosine is specified by the value.
Math.Acos(value: double)
Parameters
value
: The value on which the Acos arcosine is computed.
Returns
double
: The angle in radians.
Math.Acos(0)
// Result:
// 1.57079632679
Math.Acos(1)
// Result:
// 0.0
Math.Acos(0.5)
// Result:
// 1.0471975512
Asin
Arcsine, returns the angle in radians which sine is specified by the value.
Math.Asin(value: double)
Parameters
value
: The value on which the arcsine is computed.
Returns
double
: The angle in radians.
Math.Asin(0)
// Result:
// 0.0
Math.Asin(1)
// Result:
// 1.57079632679
Math.Asin(0.5)
// Result:
// 0.52359877559
Atan
Arctangent, returns the angle in radians which tangent is specified by the value.
Math.Atan(value: double)
Parameters
value
: The value on which the arctangent is compute.
Returns
double
: The angle in radians.
Math.Atan(0)
// Result:
// 0.0
Math.Atan(1)
// Result:
// 0.78539816339
Math.Atan(-1)
// Result:
// -0.78539816339
Atn2
Returns the angle in radians of the vector (x, y).
Math.Atn2(x: number, y: number)
Parameters
x
: The x coordinate of the vector.
y
: The y coordinate of the vector.
Returns
double
: The angle in radians.
Math.Atn2(1, 0)
// Result:
// 1.57079632679
Math.Atn2(0, 1)
// Result:
// 0.0
Math.Atn2(1, 1)
// Result:
// 0.78539816339
Ceiling
Returns the smallest integer greater or equal to the specified value.
Math.Ceiling(value: number)
Parameters
value
: The value on which the ceiling is computed.
Returns
long
: The smallest integer greater or equal to the specified value.
Math.Ceiling(1.1)
// Result:
// 2
Math.Ceiling(1.0)
// Result:
// 1
Cos
Returns the cosine specified by the value in radians.
Math.Cos(value: double)
Parameters
value
: The value on which the cosine is computed.
Returns
double
: The cosine of the specified value.
Math.Cos(0.0)
// Result:
// 1.0
Math.Cos(Math.Pi()/3)
// Result:
// 0.5
Cot
Returns the cotangent specified by the value in radians.
Math.Cot(value: double)
Parameters
value
: The value on which the cotangent is computed.
Returns
double
: The cotangent of the specified value.
Math.Cot(Math.Pi()/4)
// Result:
// 1.0
Math.Cot(Math.Pi()/2)
// Result:
// 0.0
Degrees
Converts an angle from radians to degrees.
Math.Degrees(value: double)
Parameters
value
: The angle in radians to convert to degrees.
Returns
double
: The angle in degrees.
Math.Degrees(Math.Pi()) // 180.0
// Result:
// 180.0
Math.Degrees(Math.Pi()/3) // 60.0
// Result:
// 60.0
Exp
Return the exponential of the specified value.
Math.Exp(value: double)
Parameters
value
: The value on which the exponential function is applied.
Returns
double
: The exponential of the specified value.
Math.Exp(0.0)
// Result:
// 1.0
Math.Exp(1)
// Result:
// 2.71828182845905
Floor
Returns the largest integer not greater than the value.
Math.Floor(value: decimal)
Parameters
value
: The value to be floored.
Returns
long
: The largest integer not greater than the value.
Math.Floor(1.1)
// Result:
// 1.0
Math.Floor(2.7)
// Result:
// 2.0
Log
Returns the logarithm base e specified by the value.
Math.Log(value: double)
Parameters
value
: The value on which logarithm base e is applied.
Returns
double
: The logarithm base e of the specified value.
Math.Log(1)
// Result:
// 0.0
Math.Log(2.71828182845905)
// Result:
// 1.0
Log10
Returns the logarithm base 10 specified by the value.
Math.Log10(value: double)
Parameters
value
: The value on which the logarithm base 10 is applied.
Returns
double
: The logarithm base 10 of the specified value.
Math.Log10(1)
// Result:
// 0.0
Math.Log10(10)
// Result:
// 1.0
Pi
Pi mathematical constant (3.14159...)
Math.Pi()
Returns
double
: The value of pi.
Power
Returns the first value to the power of the second value.
Math.Power(base: double, exponent: double)
Parameters
base
: The base.
exponent
: The exponent.
Returns
double
: The base to the power of the exponent.
Math.Power(2, 3)
// Result:
// 8.0
Math.Power(4, 0.5)
// Result:
// 2.0
Radians
Converts an angle from degrees to radians.
Math.Radians(value: double)
Parameters
value
: The angle in degrees to convert to radians.
Returns
double
: The angle in radians.
Math.Radians(180)
// Result:
// 3.141592653589793
Math.Radians(60.0)
// Result:
// 1.0471975512
Random
Pseudo random number generator, returns a double between 0.0 and 1.0.
Math.Random()
Returns
double
: A random number.
Sign
Returns the sign, 1, -1 or 0 for the specified value.
Math.Sign(value: number)
Parameters
value
: The value on which the sign is computed.
Returns
int
: The sign of the specified value.
Math.Sign(2)
// Result:
// 1
Math.Sign(-2)
// Result:
// -1
Math.Sign(0)
// Result:
// 0
Sin
Returns the sine specified by the value in radians.
Math.Sin(value: double)
Parameters
value
: The value on which the sine is computed.
Returns
double
: The sine of the specified value.
Math.Sin(0.0)
// Result:
// 0.0
Math.Sin(Pi()/6)
// Result:
// 0.5
Sqrt
Returns the square root of the specified value.
Math.Sqrt(value: double)
Parameters
value
: The value on which the square root is computed.
Returns
double
: The square root of the specified value.
Math.Sqrt(4)
// Result:
// 2
Math.Sqrt(2)
// Result:
// 1.41421356237
Square
Returns the square value.
Math.Square(value: double)
Parameters
value
: The value to be squared.
Returns
double
: The square value.
Math.Square(2)
// Result:
// 4.0
Math.Square(3)
// Result:
// 9.0
Tan
Returns the tangent specified by the value in radians.
Math.Tan(value: double)
Parameters
value
: The value on which the tangent is computed.
Returns
double
: The tangent of the specified value.
Math.Tan(0.0)
// Result:
// 0.0
Math.Tan(Pi()/4)
// Result:
// 1.0