pi | Pi | math.pi | 3.1415926535898 |
abs | Absolute value | math.abs(-2012) | 2012 |
ceil | Round up | math.ceil(9.1) | 10 |
floor | Round down | math.floor(9.9) | 9 |
max | Maximum of args | math.max(2,4,6,8) | 8 |
min | Minimum of args | math.min(2,4,6,8) | 2 |
pow | x to the y power | math.pow(2,16) | 65536.0 |
sqrt | Square root | math.sqrt(65536) | 256.0 |
modf | Integer and fraction parts | math.modf(20.12) | 20 0.12 |
randomseed | Set random seed | math.randomseed(os.time()) | |
random | Random number | math.random(5,90) | 5~90 |
rad | Degrees to radians | math.rad(180) | 3.1415926535898 |
deg | Radians to degrees | math.deg(math.pi) | 180.0 |
exp | e to the x | math.exp(4) | 54.598150033144 |
log | Natural log of x | math.log(54.598150033144) | 4.0 |
log10 | Base-10 log of x | math.log10(1000) | 3.0 |
frexp | Decompose to x * (2 ^ y) | math.frexp(160) | 0.625 8 |
ldexp | Compute x * (2 ^ y) | math.ldexp(0.625,8) | 160.0 |
sin | Sine | math.sin(math.rad(30)) | 0.5 |
cos | Cosine | math.cos(math.rad(60)) | 0.5 |
tan | Tangent | math.tan(math.rad(45)) | 1.0 |
asin | Arcsine | math.deg(math.asin(0.5)) | 30.0 |
acos | Arccosine | math.deg(math.acos(0.5)) | 60.0 |
atan | Arctangent | math.deg(math.atan(1)) | 45.0 |