Math类的常量与方法

Math.PI  圆周率

Math.abs  绝对值

Math.sin  正弦

Math.cos  余弦

Math.tan  正切

Math.ceil  得到最接近参数的最大整数(Math.ceil(-0.5)返回-0.0,带负号)(参数为整数则返回它本身)

Math.floor  等到不大于参数的最大整数(参数为整数则返回它本身)

Math.max  求两数的最大值

Math.min  求两数最小值

Math.pow(x,y)  求某数的任意次方根  抛出ArithmeticException溢出异常

   Math.sqrt(x)  x的平方根

扫描二维码关注公众号,回复: 1822329 查看本文章

   Math.pow(x,y)  x的y次方根

Math.log10  以10为底的对数

Math.rint  求距离某数最近的整数

猜你喜欢

转载自blog.csdn.net/qq_38974073/article/details/74910421