• js 中 math 的方法


    Math.min()      //获取一组数值中的最小值
    Math.max()     //获取一组数值中的最大值

    Math.ceil()      //将数值中向上舍入为最接近的整数
    Math.floor()         //将数值中向下舍入为最接近的整数
    Math.round()       //将数值中四舍五入为最接近的整数

    Math.random()        //返回0-1之间的一个随机数,不包括0和1
    Math.floor(Math.random() * 10 +1) 随机产生1-10之间的任意数

    Math.abs(n)          //返回n的绝对值
    Math.exp(n)           //返回 E 的n次幂 E:自然底数,近似值2.7183
    Math.log(n)          //返回n的自然对数
    Math.pow(n,p)        //返回n的p次幂
    Math.sqrt(n)         //返回n的平方根

    Math.cos(x)          //返回x的余弦值
    Math.sin(x)          //返回x的正弦值
    Math.tan(x)          //返回x的正切值
    Math.acos(x)           //返回x的反余弦值
    Math.asin(x)          //返回x的反正弦值
    Math.atan(x)           //返回x的反正切值
    Math.atan2(y,x)            //返回y/x的反正切值

    Math.PI = 3.14 = 180°    // PI : 圆周率π 

  • 相关阅读:
    Java数据库操作学习
    c3p0配置
    CachedRowSet 接口
    Android Library的依赖方式及发布(转)
    网站测试
    MySQL Server逻辑架构
    Service生命周期
    Activity的生命周期
    Android应用框架中的四个核心要点
    Android 最新架构
  • 原文地址:https://www.cnblogs.com/houBlogs/p/14544417.html
Copyright © 2020-2023  润新知