Math - Kirix Documentation

Developer Resources

Math

Overview

The Math object provides common math functionality through a collection of static functions on the object.

Methods

Math.abs
Returns the absolute value of a number.
Math.acos
Returns the arc cosine of a number.
Math.asin
Returns the arc sine of a number.
Math.atan
Returns the arc tangent of a number.
Math.atan2
Returns the arc tangent of a number.
Math.ceil
Returns the smallest integer greater than a number.
Math.cos
Returns the cosine of a number.
Math.exp
Returns e to the power of a number.
Math.floor
Returns the largest integer less than a number.
Math.log
Returns the natural logarithm of a number.
Math.max
Returns the maximum number from a series of numbers.
Math.min
Returns the minimum number from a series of numbers.
Math.pow
Returns a number raised to the power of another number.
Math.random
Returns a random number.
Math.round
Returns the integer nearest to a number.
Math.sin
Returns the sine of a number.
Math.sqrt
Returns the square root of a number.
Math.tan
Returns the tangent of a number.

Math.abs

static function Math.abs(number : Number) : Number

Arguments

number
The number for which to return the absolute value.

Returns

Returns the absolute value of a number.

Description

Returns the absolute value of a number.

Math.acos

static function Math.acos(number : Number) : Number

Returns

Returns the arc cosine of a number.

Description

Returns the arc cosine of a number, where number must be between -1 and 1. If number is not between -1 and 1, the function returns NaN. Param: The number for which to return the arc cosine.

Math.asin

static function Math.asin(number : Number) : Number

Arguments

number
The number for which to return the arc sine.

Returns

Returns the arc sine of a number.

Description

Returns the arc sine of a number, where number must be between -1 and 1. If number is not between -1 and 1, the function returns NaN.

Math.atan

static function Math.atan(number : Number) : Number

Arguments

number
The number for which to return the arc tangent.

Returns

Returns the arc tangent of a number.

Description

Returns the arc tangent of a number.

Math.atan2

static function Math.atan2(y : Number, x : Number) : Number

Arguments

x
The y-coordinate.
y
The x-coordinate.

Returns

Returns the arc tangent of y/x.

Description

Returns the arc tangent of y/x.

Math.ceil

static function Math.ceil(number : Number) : Integer

Arguments

number
The number for which to find the smallest integer greater than it.

Returns

Returns the smallest integer greater than the number.

Description

Returns the smallest integer greater than a number.

Math.cos

static function Math.cos(number : Number) : Number

Arguments

number
The number for which to return the cosine.

Returns

Returns the cosine of a number.

Description

Returns the cosine of a number.

Math.exp

static function Math.exp(number : Number) : Number

Arguments

number
The number to raise e to the power of.

Returns

Returns e to the power of a number.

Description

Returns e to the power of a number.

Math.floor

static function Math.floor(number : Number) : Integer

Arguments

number
The number for which to find the largest integer less than it.

Returns

Returns the largest integer less than a number.

Description

Returns the largest integer less than a number.

Math.log

static function Math.log(number : Number) : Number

Returns

Returns the natural logarithm of a number.

Description

Returns the natural logarithm of a number, when the number is greater than 0. If the number is less than 0, the function returns NaN. Param: The number for which to find the natural logarithm.

Math.max

static function Math.max(num_0 : Number, ..., num_n : Number) : Number

Arguments

num_0, ..., num_n
A series of numbers for which to find the maximum.

Returns

The maximum number of a series of numbers.

Description

Returns the maximum number of a series of input numbers, specified by num_0, ..., num_n. If no input numbers are specified, the function returns -Infinity.

Math.min

static function Math.min(num_0 : Number, ..., num_n : Number) : Number

Arguments

num_0, ..., num_n
A series of numbers for which to find the minimum.

Returns

The minimum number of a series of numbers.

Description

Returns the minimum number of a series of input numbers, specified by num_0, ..., num_n. If no input numbers are specified, the function returns +Infinity.

Math.pow

static function Math.pow(base : Number, exponent : Number) : Number

Arguments

base
The base.
exponent
The exponent.

Returns

Returns base to the power of exponent.

Description

Returns base to the power of exponent.

Math.random

static function Math.random() : Number

Returns

Returns a random number between 0 and 1.

Description

Returns a random number between 0 and 1.

Math.round

static function Math.round(number : Number) : Integer

Returns

Returns the integer nearest to the specified number.

Description

Returns the integer nearest to the specified number. If the given number is exactly half way between two integers, the function will round up, i.e. X.5 becomes X+1.

Math.sin

static function Math.sin(number : Number) : Number

Arguments

number
The number for which to return the sine.

Returns

Returns the sine of a number.

Description

Returns the sine of a number.

Math.sqrt

static function Math.sqrt(number : Number) : Number

Arguments

number
The number for which to calculate the square root.

Returns

Returns the square root of a number.

Description

Returns the square root of a number. If the number is less than 0, the function returns NaN.

Math.tan

static function Math.tan(number : Number) : Number

Arguments

number
The number for which to return the tangent.

Returns

Returns the tangent of a number.

Description

Returns the tangent of a number.