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.
Returns
  • number: The absolute value of the input.
Example:
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.

Syntax:
Math.Acos(value: double)
Parameters
  • value: The value on which the Acos arcosine is computed.
Returns
  • double: The angle in radians.
Example:
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.

Syntax:
Math.Asin(value: double)
Parameters
  • value: The value on which the arcsine is computed.
Returns
  • double: The angle in radians.
Example:
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.

Syntax:
Math.Atan(value: double)
Parameters
  • value: The value on which the arctangent is compute.
Returns
  • double: The angle in radians.
Example:
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).

Syntax:
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.
Example:
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.

Syntax:
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.
Example:
Math.Ceiling(1.1)
// Result:
// 2

Math.Ceiling(1.0)
// Result:
// 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.
Returns
  • double: The cosine of the specified value.
Example:
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.

Syntax:
Math.Cot(value: double)
Parameters
  • value: The value on which the cotangent is computed.
Returns
  • double: The cotangent of the specified value.
Example:
Math.Cot(Math.Pi()/4)
// Result:
// 1.0

Math.Cot(Math.Pi()/2)
// Result:
// 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.
Returns
  • double: The angle in degrees.
Example:
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.

Syntax:
Math.Exp(value: double)
Parameters
  • value: The value on which the exponential function is applied.
Returns
  • double: The exponential of the specified value.
Example:
Math.Exp(0.0)
// Result:
// 1.0

Math.Exp(1)
// Result:
// 2.71828182845905

Floor

Returns the largest integer not greater than the value.

Syntax:
Math.Floor(value: decimal)
Parameters
  • value: The value to be floored.
Returns
  • long: The largest integer not greater than the value.
Example:
Math.Floor(1.1)
// Result:
// 1.0

Math.Floor(2.7)
// Result:
// 2.0

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.
Returns
  • double: The logarithm base e of the specified value.
Example:
Math.Log(1)
// Result:
// 0.0

Math.Log(2.71828182845905)
// Result:
// 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.
Returns
  • double: The logarithm base 10 of the specified value.
Example:
Math.Log10(1)
// Result:
// 0.0

Math.Log10(10)
// Result:
// 1.0

Pi

Pi mathematical constant (3.14159...)

Syntax:
Math.Pi()
Returns
  • double: The value of 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.

Returns
  • double: The base to the power of the exponent.
Example:
Math.Power(2, 3)
// Result:
// 8.0

Math.Power(4, 0.5)
// Result:
// 2.0

Radians

Converts an angle from degrees to radians.

Syntax:
Math.Radians(value: double)
Parameters
  • value: The angle in degrees to convert to radians.
Returns
  • double: The angle in radians.
Example:
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.

Syntax:
Math.Random()
Returns
  • double: A random number.

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.
Returns
  • int: The sign of the specified value.
Example:
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.

Syntax:
Math.Sin(value: double)
Parameters
  • value: The value on which the sine is computed.
Returns
  • double: The sine of the specified value.
Example:
Math.Sin(0.0)
// Result:
// 0.0

Math.Sin(Pi()/6)
// Result:
// 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.
Returns
  • double: The square root of the specified value.
Example:
Math.Sqrt(4)
// Result:
// 2

Math.Sqrt(2)
// Result:
// 1.41421356237

Square

Returns the square value.

Syntax:
Math.Square(value: double)
Parameters
  • value: The value to be squared.
Returns
  • double: The square value.
Example:
Math.Square(2)
// Result:
// 4.0

Math.Square(3)
// Result:
// 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.
Returns
  • double: The tangent of the specified value.
Example:
Math.Tan(0.0)
// Result:
// 0.0

Math.Tan(Pi()/4)
// Result:
// 1.0