Math常见函数!要记!很方便!!

Math常见函数

括号内什么都没写的意思就是括号内double,int,long,float均可

目的 函数 注意
求绝对值: Math.abs();
求a的b次方: Math.pow(double a,double b); eg:int a=(int)Math.pow(10,3);
求根号a: Math.sqrt(double a);
求两数最大值: Math.max();
求两数最小值: Math.min();
求自然对数e的a次幂: Math.exp(double a);
求自然对数: Math.E
求圆周率: Math.PI

猜你喜欢

转载自blog.csdn.net/weixin_46020391/article/details/112904654