数学库由算术函数的标准集合组成,比如三角函数库(sin, cos, tan, asin, acos, etc.),幂指函数(exp, log, log10),舍入函数(floor, ceil)、max、min,加上一个变量 pi。数学库也定义了一个幂操作符(^)。
- local sin, asin= math.sin, math.asin
- local deg, rad = math.deg, math.rad
- math.sin = function (x) return sin(rad(x)) end
- math.asin = function (x) return deg(asin(x)) end
相关函数请查询文档。