Methods

abs

static

abs(num) returns number

Absolute value of the input.

Parameter

num

number

Numeric value.

Returns

number the absolute value.

Example

math.abs(-1) == 1
math.abs(1) == 1

abs

static

abs(num) returns number

Absolute value of a numeric value.

Parameter

num

number

Numeric value.

Returns

non-null number the absolute numeric value of the input.

Example

math.abs(-1) == 1

ceil

static

ceil(num) returns rules.Integer

Ceiling of the numeric value.

Parameter

num

number

Numeric value.

Returns

non-null rules.Integer the ceiling of the given value.

Example

math.ceil(2.0) == 2
math.ceil(2.1) == 3
math.ceil(2.7) == 3

floor

static

floor(num) returns rules.Integer

Floor of the numeric value.

Parameter

num

number

Numeric value.

Returns

non-null rules.Integer the floor of the given value.

Example

math.floor(1.9) == 1
math.floor(2.0) == 2
math.floor(2.7) == 2

isInfinite

static

isInfinite(num) returns rules.Boolean

Test whether the value is ±∞.

Parameter

num

number

Numeric value.

Returns

non-null rules.Boolean true if the number is positive or negative infinity.

Example

math.isInfinite(∞) == true
math.isInfinite(100) == false

isNaN

static

isNaN(num) returns rules.Boolean

Test whether the value is ±∞.

Parameter

num

number

Numeric value.

Returns

non-null rules.Boolean true if the value is not a number.

Example

math.isNaN(NaN) == true
math.isNaN(100) == false

round

static

round(num) returns rules.Integer

Round the input value to the nearest int.

Parameter

num

number

Numeric value.

Returns

non-null rules.Integer the nearest int to the given value.

Example

math.round(1.9) == 2
math.round(2.4) == 2
math.round(2.5) == 3