Debian Codegraph @

docs/math.md

raw
1 # Integer Math Functions
2
3 The following math functions operate on `int64` values.
4
5 ## add
6
7 Sum numbers with `add`. Accepts two or more inputs.
8
9 ```
10 add 1 2 3
11 ```
12
13 ## add1
14
15 To increment by 1, use `add1`
16
17 ## sub
18
19 To subtract, use `sub`
20
21 ## div
22
23 Perform integer division with `div`
24
25 ## mod
26
27 Modulo with `mod`
28
29 ## mul
30
31 Multiply with `mul`. Accepts two or more inputs.
32
33 ```
34 mul 1 2 3
35 ```
36
37 ## max
38
39 Return the largest of a series of integers:
40
41 This will return `3`:
42
43 ```
44 max 1 2 3
45 ```
46
47 ## min
48
49 Return the smallest of a series of integers.
50
51 `min 1 2 3` will return `1`
52
53 ## floor
54
55 Returns the greatest float value less than or equal to input value
56
57 `floor 123.9999` will return `123.0`
58
59 ## ceil
60
61 Returns the greatest float value greater than or equal to input value
62
63 `ceil 123.001` will return `124.0`
64
65 ## round
66
67 Returns a float value with the remainder rounded to the given number to digits after the decimal point.
68
69 `round 123.555555 3` will return `123.556`
70
71 ## randInt
72 Returns a random integer value from min (inclusive) to max (exclusive).
73
74 ```
75 randInt 12 30
76 ```
77
78 The above will produce a random number in the range [12,30].