Skip to main content

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.

Syntax:
Math.Abs(value: number)
Parameters
  • value: The value on which the absolute value is computed.
Example:
Abs(1) // 1
Abs(-1) // 1

Abs(0.0) // 0.0
Abs(-1.2) // 1.2

Acos

Arcosine, returns the angle in radians which cosine is specified by the value.

Syntax:
Math.Acos(value: double)
Parameters
  • value: The value on which the Acos arcosine is computed.
Example:
Acos(0) // Pi/2 ~= 1.57079632679
Acos(1) // 0.0
Acos(0.5) // Pi/3 ~= 1.0471975512

Asin

Arcsine, returns the angle in radians which sine is specified by the value.

Syntax:
Math.Asin(value: double)
Parameters
  • value: The value on which the arcsine is computed.
Example:
Asin(0) // 0.0
Asin(1) // Pi/2 ~= 1.57079632679
Asin(0.5) // Pi/6 ~= 0.52359877559

Atan

Arctangent, returns the angle in radians which tangent is specified by the value.

Syntax:
Math.Atan(value: double)
Parameters
  • value: The value on which the arctangent is compute.
Example:
Atan(0) // 0.0
Atan(1) // Pi/4 ~= 0.78539816339
Atan(-1) // -Pi/4 ~= -0.78539816339

Atn2

Returns the angle in radians of the vector (x, y).

Syntax:
Math.Atn2(x: number, y: number)
Parameters
  • x: The x coordinate of the vector.
  • y: The y coordinate of the vector.
Example:
Atn2(1, 0) // Pi/2 ~= 1.57079632679
Atn2(0, 1) // 0.0
Atn2(1, 1) // Pi/4 ~= 0.78539816339

Ceiling

Returns the smallest integer greater or equal to the specified value.

Syntax:
Math.Ceiling(value: number)
Parameters
  • value: The value on which the ceiling is computed.
Example:
Ceiling(1.1) // 2
Ceiling(1.0) // 1

Cos

Returns the cosine specified by the value in radians.

Syntax:
Math.Cos(value: double)
Parameters
  • value: The value on which the cosine is computed.
Example:
Cos(0.0) // 1.0
Cos(Pi()/3)// 0.5

Cot

Returns the cotangent specified by the value in radians.

Syntax:
Math.Cot(value: double)
Parameters
  • value: The value on which the cotangent is computed.
Example:
Cot(Pi()/4) // 1.0
Cot(Pi()/2)// 0.0

Degrees

Converts an angle from radians to degrees.

Syntax:
Math.Degrees(value: double)
Parameters
  • value: The angle in radians to convert to degrees.
Example:
Degrees(Pi()) // 180.0
Degrees(Pi()/3) // 60.0

Exp

Return the exponential of the specified value.

Syntax:
Math.Exp(value: double)
Parameters
  • value: The value on which the exponential function is applied.
Example:
Exp(0.0) // 1.0
Exp(1) // ~= 2.71828182845905 (Euler's number)

Floor

Returns the largest integer not greater than the value.

Syntax:
Math.Floor(value: decimal)
Parameters
  • value: The value to be floored.
Example:
Floor(1.1) // 1
Floor(2.7) // 2

Log

Returns the logarithm base e specified by the value.

Syntax:
Math.Log(value: double)
Parameters
  • value: The value on which logarithm base e is applied.
Example:
Log(1) // 0.0
Log(2.71828182845905) // ~= 1.0

Log10

Returns the logarithm base 10 specified by the value.

Syntax:
Math.Log10(value: double)
Parameters
  • value: The value on which the logarithm base 10 is applied.
Example:
Log10(1) // 0.0
Log10(10) // 1.0

Pi

Pi mathematical constant (3.14159...)

Syntax:
Math.Pi()

Power

Returns the first value to the power of the second value.

Syntax:
Math.Power(base: double, exponent: double)
Parameters
  • base: The base.
  • exponent: The exponent.
Example:
Power(2, 3) // 8
Power(4, 0.5) // 2

Radians

Converts an angle from degrees to radians.

Syntax:
Math.Radians(value: double)
Parameters
  • value: The angle in degrees to convert to radians.
Example:
Radians(180) // Pi ~= 3.141592653589793
Radians(60.0) // Pi/3 ~= 1.0471975512

Random

Pseudo random number generator, returns a double between 0.0 and 1.0.

Syntax:
Math.Random()

Sign

Returns the sign, 1, -1 or 0 for the specified value.

Syntax:
Math.Sign(value: number)
Parameters
  • value: The value on which the sign is computed.
Example:
Sign(2) // 1
Sign(-2) // -1
Sign(0) // 0

Sin

Returns the sine specified by the value in radians.

Syntax:
Math.Sin(value: double)
Parameters
  • value: The value on which the sine is computed.
Example:
Sin(0.0) // 0.0
Sin(Pi()/6)// 0.5

Sqrt

Returns the square root of the specified value.

Syntax:
Math.Sqrt(value: double)
Parameters
  • value: The value on which the square root is computed.
Example:
SQRT(4) // 2
SQRT(2) // 1.41421356237

Square

Returns the square value.

Syntax:
Math.Square(value: double)
Parameters
  • value: The value to be squared.
Example:
Square(2) // 4.0
Square(3) // 9.0

Tan

Returns the tangent specified by the value in radians.

Syntax:
Math.Tan(value: double)
Parameters
  • value: The value on which the tangent is computed.
Example:
Tan(0.0) // 0.0
Tan(Pi()/4) // 1.0