java.lang.Math主要介绍
都是静态static的,所以直接使用类名Math调用。
比如:Math.sin(a)
Modifier and Type | Field | Description |
---|
static final double | E | 自然对数函数的底数e |
static final double | PI | 圆周率π |
Modifier and Type | Method | Description |
---|
static double | abs(double a) (绝对值absolute vaule) | 返回双精度值double的绝对值 |
static float | abs(float a) | 返回浮点值float的绝对值。 |
static int | abs(int a) | 返回整数值int的绝对值 |
static long | abs(long a) | 返回长值long的绝对值。 |
| | |
| | |
static double | acos(double a) | y=arccosx(y的范围0.0~pi) |
static double | asin(double a) | y=arcsinx(y的范围-pi/2~pi/2) |
static double | atan(double a) | y=arctanx(y的范围-pi/2~pi/2) |
| | |
| | |
static double | cos(double a) | y=cosx |
static double | sin(double a) | y=sinx |
static double | tan(double a) | y=tanx |
static long | round(double a) | 对参数进行四舍五入取整运算 |
static int | round(float a) | 对参数进行四舍五入取整运算 |
static double | cbrt(double a)(立方根cube root) | 一个双精度值double的立方根 |
static double | sqrt(double a) | 平方根 |
static double | hypot(double x, double y) | sqrt(x2 +y2) |
static double | ceil(double a) | 对参数进行正无穷方向取整 |
static double | floor(double a) | 对参数进行负无穷方向取整 |
| | |
| | |
static double | exp(double a) | ea |
static double | expm1(double x) | ex -1 |
static double | pow(double a, double b) | ab |
| | |
| | |
static double | log(double a) | 返回以e为底的对数值,即ln a |
static double | log10(double a) | 返回以10为底的对数值 |
static double | log1p(double x) | ln(x + 1) |
| | |
| | |
static double | max(double a, double b) | 两个数之中的更大值 |
static float | max(float a, float b) | 两个数之中的更大值 |
static int | max(int a, int b) | 两个数之中的更大值 |
static long | max(long a, long b) | 两个数之中的更大值 |
| | |
| | |
static double | min(double a, double b) | 两个数之中的更小值 |
static float | min(float a, float b) | 两个数之中的更小值 |
static int | min(int a, int b) | 两个数之中的更小值 |
static long | min(long a, long b) | 两个数之中的更小值 |
| | |
| | |
static double | random() | 返回一个正double值,范围在0.0~1.0 |
static double | toDegrees(double angrad) | 弧度转换为角度 |
static double | toRadians(double angdeg) | 角度转换为弧度 |