-
Notifications
You must be signed in to change notification settings - Fork 4
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.
Returns the absolute value of a number.
[ABS (number: number)]
Example code:
[ABS 101]
> 101
[ABS -101]
> 101
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
Rounds an argument to the next highest whole number.
[CEIL (numToRound: number)]
Example code:
[CEIL 0.6]
> 1
[CEIL -5.723]
> -5
Rounds an argument to the next lowest whole number.
[FLOOR (numToRound: number)]
Example code:
[FLOOR 0.6]
> 0
[FLOOR -5.723]
> -6
Rounds a number to the nearest whole number.
[ROUND (numToRound: number)]
Example code:
[ROUND 0.6]
> 1
[ROUND -5.723]
> -6
Numbers n' Vars || Arrays || Strings || Control flow || Meta || # || How do I start?