Skip to content

Math functions

Inferno edited this page Jan 3, 2023 · 5 revisions

Math functions

These are the functions that have a relation to math (i know, surprising). In other words, these functions will take numbers in as input, and perform mathematical operations on these numbers, and output the result.

abs

Returns the absolute value of a number.

[ABS (number: number)]

Example code:

[ABS 101]
> 101

[ABS -101]
> 101

add, div, mod, mul, pow, sub

Adds 2 or more numbers together.

[(add/div/mod/mul/pow/sub) (number1: number) (number2: number...)]

Example code:

[ADD 1 4]
> 5

[ADD 1 1 1 1 1]
> 5

[DIV 10 5 2]
> 1

[DIV 10 5]
> 2

[MOD 101 11]
> 2

[MOD 100 51 11]
> 5

[POW 4 2]
> 16

[POW 4 2 2]
> 256

ceil

Rounds an argument to the next highest whole number.

[CEIL (numToRound: number)]

Example code:

[CEIL 0.6]
> 1
[CEIL -5.723]
> -5

floor

Rounds an argument to the next lowest whole number.

[FLOOR (numToRound: number)]

Example code:

[FLOOR 0.6]
> 0
[FLOOR -5.723]
> -6

round

Rounds a number to the nearest whole number.

[ROUND (numToRound: number)]

Example code:

[ROUND 0.6]
> 1
[ROUND -5.723]
> -6
Clone this wiki locally