math对象方法

math对象方法:

  math.abs(x)     返回x的绝对值

  math.ceil(x)      返回x的上舍入

  math.floor(x)  返回x的下舍入

  math.max()      返回最大值   (必须是数字)

  math.min()    返回最小值

  math.random() 返回0-1之间的随机数

  math.round()  返回四舍五入的值

  math.PI         返回π

  math.sqrt(x)  返回x的平方根

  math.sin(x)    返回的是x的正弦(对边比斜边)

  math.cos(x)    返回的是x的余弦(邻边比斜边)

  math.tan(x)      返回的是x的正切(对边比邻边)

  math.asin(x)     返回的是x的反正弦值

  math.acos(x)    返回的是x的反余弦值

  math.atan(x)    返回的是x的反正切值 

posted @ 2018-12-17 20:08  web前端探索者  阅读(356)  评论(0编辑  收藏  举报