math: Mathematical functions

This module contains several basic mathematical functions and a few numeric constants. All operations are implemented using floating point arithmetic, and all functions return Float values. Functions accept integer arguments in addition to floats, but integer arguments are converted to floats internally. The argument types below only include Float for conciseness.

All angles are in radians.

Functions

Sqrt(x as Float) as Float
Return the square root of x.
Sin(x as Float) as Float
Return the sine of x.
Cos(x as Float) as Float
Return the cosine of x.
Tan(x as Float) as Float
Return the tangent of x.
ArcSin(x as Float) as Float
Return the arc sine of x.
ArcCos(x as Float) as Float
Return the arc cosine of x.
ArcTan(y as Float[, x as Float]) as Float
Return the arc tangent of y or y / x. If x is negative, the magnitude of the result will be chosen to be between Pi / 2 and Pi; otherwise, the magnitude of the result is at most Pi / 2.
Ceil(x as Float) as Float
Return x rounded up to the nearest integer.
Floor(x as Float) as Float
Return x rounded down to the nearest integer.
Round(x as Float) as Float
Return x rounded to the nearest integer.
Trunc(x as Float) as Float
Return x rounded to the nearest integer towards zero.
Exp(x as Float) as Float
Return e**x.
Log(x as Float) as Float
Return the natural logarithm of x.

Note: The logarithm in base y can be calculated as Log(x) / Log(y).

IsInf(x as Float) as Boolean
Return a boolean indicating whether x is IEEE 754 positive or negative infinity.
IsNaN(x as Float) as Boolean
Return a boolean indicating whether x is IEEE 754 NaN (Not-a-Number).

Constants

Pi as Float
The constant pi, approximately 3.14159.
E as Float
The constant e, approximately 2.71828.