math方法集合

时间:2023-03-09 09:01:34
math方法集合

math.abs(x)     返回数的绝对值。
math.acos(x)     返回数的反余弦值。
math.asin(x)     返回数的反正弦值。
math.atan(x)     以介于 -PI/2 与 PI/2 弧度之间的数值来返回 x 的反正切值。
math.atan2(y,x)     返回从 x 轴到点 (x,y) 的角度(介于 -PI/2 与 PI/2 弧度之间)。
math.ceil(x)     对数进行上舍入。
math.cos(x)     返回数的余弦。
math.exp(x)     返回 e 的指数。
math.floor(x)     对数进行下舍入。
math.log(x)     返回数的自然对数(底为e)。
math.max(x,y)     返回 x 和 y 中的最高值。
math.min(x,y)     返回 x 和 y 中的最低值。
math.pow(x,y)     返回 x 的 y 次幂。
math.random()     返回 0 ~ 1 之间的随机数。
math.round(x)     把数四舍五入为最接近的整数。
math.sin(x)     返回数的正弦。
math.sqrt(x)     返回数的平方根。
math.tan(x)     返回角的正切。
math.toSource()     返回该对象的源代码。
math.valueOf()     返回 Math 对象的原始值。