The Math Library

The Math library provides trigonometric and other advanced mathematical functions and constants.
For commonly used, simple mathematical functions take a look at the Number type.

Usage

To use any of the functions described on this page, you must prefix them with the Math library name:

Math.sin(Math.pi / 2)    // results in 1

If you cannot use the library because you already named something else "Math", you can explicitly refer to it by prefixing it with Combeenation (or Cbn for short):

Combeenation.Math.sin(Cbn.Math.pi / 2)    // also results in 1

Constants

Name Description
pi The number π
e The number e (natural logarithmic base)

Functions

The Math library offers the following functions:

Name Description
abs Returns the absolute value of a number
sqrt Returns the square root of a number
random Returns a random number
max Returns the greater of two numbers
min Returns the lesser of two numbers
sin, sinr Returns the sine of the specified angle
cos, cosr Returns the cosine of the specified angle
tan, tanr Returns the tangent of the specified angle
asin, asinr Returns the angle whose sine is the specified number
acos, acosr Returns the angle whose cosine is the specified number
atan, atanr Returns the angle whose tangent is the specified number