| 1 |
# Float Math Functions |
| 2 |
|
| 3 |
All math functions operate on `float64` values. |
| 4 |
|
| 5 |
## addf |
| 6 |
|
| 7 |
Sum numbers with `addf` |
| 8 |
|
| 9 |
This will return `5.5`: |
| 10 |
|
| 11 |
``` |
| 12 |
addf 1.5 2 2 |
| 13 |
``` |
| 14 |
|
| 15 |
## add1f |
| 16 |
|
| 17 |
To increment by 1, use `add1f` |
| 18 |
|
| 19 |
## subf |
| 20 |
|
| 21 |
To subtract, use `subf` |
| 22 |
|
| 23 |
This is equivalent to `7.5 - 2 - 3` and will return `2.5`: |
| 24 |
|
| 25 |
``` |
| 26 |
subf 7.5 2 3 |
| 27 |
``` |
| 28 |
|
| 29 |
## divf |
| 30 |
|
| 31 |
Perform integer division with `divf` |
| 32 |
|
| 33 |
This is equivalent to `10 / 2 / 4` and will return `1.25`: |
| 34 |
|
| 35 |
``` |
| 36 |
divf 10 2 4 |
| 37 |
``` |
| 38 |
|
| 39 |
## mulf |
| 40 |
|
| 41 |
Multiply with `mulf` |
| 42 |
|
| 43 |
This will return `6`: |
| 44 |
|
| 45 |
``` |
| 46 |
mulf 1.5 2 2 |
| 47 |
``` |
| 48 |
|
| 49 |
## maxf |
| 50 |
|
| 51 |
Return the largest of a series of floats: |
| 52 |
|
| 53 |
This will return `3`: |
| 54 |
|
| 55 |
``` |
| 56 |
maxf 1 2.5 3 |
| 57 |
``` |
| 58 |
|
| 59 |
## minf |
| 60 |
|
| 61 |
Return the smallest of a series of floats. |
| 62 |
|
| 63 |
This will return `1.5`: |
| 64 |
|
| 65 |
``` |
| 66 |
minf 1.5 2 3 |
| 67 |
``` |
| 68 |
|
| 69 |
## floor |
| 70 |
|
| 71 |
Returns the greatest float value less than or equal to input value |
| 72 |
|
| 73 |
`floor 123.9999` will return `123.0` |
| 74 |
|
| 75 |
## ceil |
| 76 |
|
| 77 |
Returns the greatest float value greater than or equal to input value |
| 78 |
|
| 79 |
`ceil 123.001` will return `124.0` |
| 80 |
|
| 81 |
## round |
| 82 |
|
| 83 |
Returns a float value with the remainder rounded to the given number to digits after the decimal point. |
| 84 |
|
| 85 |
`round 123.555555` will return `123.556` |