The following are the mathematical functions you can use in COD scripts. In most cases, the syntax can be copied/pasted directly into a file and function properly. They should be edited for your particular use. This allows you to short cut your time by not having to experiment to figure out code syntax.
Function | Example | Return Value |
---|---|---|
abs | abs(-3, 4) | 3.4 |
acos | acos(3, 4) | 41.4096221 |
asin | asin(3, 4) | 48.5903779 |
atan | atan(3, 4) | 36.8698976 |
cos | cos(45) | 0.7071068 |
exp | exp(2) | 10 |
log | log(100) | 2 |
number | number("5") number("5.0") number("5.5") | 5 5 5.5 |
pow | pow(5, 2) pow(2, 3) | 25 8 |
round | round(5.49) round(5.50) round(5.449, 1) round(5.450, 1) | 5 6 5.4 5.5 |
rounddown | rounddown(5.934) rounddown(5.934, 1) rounddown(5.934, 2) | 5 5.9 5.93 |
roundup | roundup(5.145) roundup(5.145, 1) roundup(5.145, 2) | 6 5.2 5.15 |
sign | sign(-3.4) sign(3.4) sign(0.000001) | -1 1 0 |
sin | sin(45) | 0.7071068 |
sqrt | sqrt(4) | 2 |
sqr | sqr(2) | 4 |
tan | tan(45) | 1 |