Math

The 'math' module provides math functions

Function Signatures

// Rounds a number up to the nearest integer.
const ceil = (value: Number) => Number

// Rounds a number down to the nearest integer.
const floor = (value: Number) => Number

// Returns the absolute value of a number.
const abs = (value: Number) => Number

// Returns the square root of a number.
const sqrt = (value: Number) => Number

// Returns the integer part of a number by removing any fractional digits.
const trunc = (value: Number) => Number

// Returns the natural logarithm (base e) of a number.
const log = (value: Number, base: Number) => Number

// Returns the result of raising a number to a specified power.
const pow = (value: Number, exponent: Number) => Number

// Returns the tangent of an angle.
const tan = (value: Number) => Number

// Returns the sine of an angle.
const sin = (value: Number) => Number

// Returns the cosine of an angle.
const cos = (value: Number) => Number

// Multiplies a 4-dimensional vector by a 4x4 matrix.
const multMat4 = (vec: [Number], mat: [[Number]]) => [Number]

Last updated