| pi | math.pi | 3.1415926535898 | |
| abs | math.abs(-2012) | 2012 | |
| ceil | math.ceil(9.1) | 10 | |
| floor | math.floor(9.9) | 9 | |
| max | math.max(2,4,6,8) | 8 | |
| min | math.min(2,4,6,8) | 2 | |
| pow | math.pow(2,16) | 65536 | |
| sqrt | math.sqrt(65536) | 256 | |
| mod | 取模 | math.mod(65535,2) | 1 |
| modf | math.modf(20.12) | 20 0.12 | |
| randomseed | math.randomseed(os.time()) | ||
| random | math.random(5,90) | 5~90 | |
| rad | math.rad(180) | 3.1415926535898 | |
| deg | math.deg(math.pi) | 180 | |
| exp | math.exp(4) | 54.598150033144 | |
| log | math.log(54.598150033144) | 4 | |
| log10 | math.log10(1000) | 3 | |
| frexp | math.frexp(160) | 0.625 8 | |
| ldexp | math.ldexp(0.625,8) | 160 | |
| sin | 姝e鸡 | math.sin(math.rad(30)) | 0.5 |
| cos | math.cos(math.rad(60)) | 0.5 | |
| tan | math.tan(math.rad(45)) | 1 | |
| asin | math.deg(math.asin(0.5)) | 30 | |
| acos | math.deg(math.acos(0.5)) | 60 | |
| atan | math.deg(math.atan(1)) | 45 |
转载请标明出处:Lua 数学函数
文章来源: Lua 数学函数