介绍
类Math
包含用于执行基本数字运算的方法,例如基本指数,对数,平方根和三角函数;它位于java.lang中,所有方法都是静态方法,可以用类名.方法名的方法直接调用。
方法汇总:
变量和类型 | 字段 | 描述 |
字段 | ||
static double | E | double值比任何其他值更接近e,即自然对数的基数 |
static double | PI | double值比任何其他pi更接近,圆的圆周与其直径的比率。 |
方法摘要 | ||
static double | abs(double a) | 返回double值的绝对值 |
static float | abs(float a) | 返回float值的绝对值 |
static int | abs(int a) | 返回int值的绝对值 |
static long | abs(long a) | 返回long值的绝对值 |
static double | acos(double a) | 返回值的反余弦值;返回角度在0.0到pi的范围内 |
static int | addExact(int x, int y) | 返回其参数的总和,如果结果溢出 int 则抛出异常。 |
static long | addExact(long x, long y) | 返回其参数的总和,如果结果溢出 long则抛出异常。 |
static double | asin(double a) | 返回值的反正弦值; 返回的角度在-pi / 2到pi / 2的范围内。 |
static double | atan(double a) | 返回值的反正切值; 返回的角度在-pi / 2到pi / 2的范围内。 |
static double | atan2(double x,double y) | 返回从直角坐标(转换角度 theta x , y )为极坐标 (R,θ-)。 |
static double | cbrt(double a) | 返回 double 值的多维数据集根。 |
static double | ceil(double a) | 返回大于或等于参数且等于数学整数的最小值(最接近负无穷大) double 。 |
static double | copySign(double magnitude, double sign) | 返回带有第二个浮点参数符号的第一个浮点参数。 |
static float | copySign(float magnitude, float sign) | 返回带有第二个浮点参数符号的第一个浮点参数。 |
static double | cos(double a) | 返回角度的三角余弦值。 |
static double | cosh(double x) | 返回double值的双曲余弦值。 |
static int | decrementExact(int a) | 返回参数递减1,如果结果溢出int则抛出异常 |
static long | decrementExact(long a) | 返回参数递减1,如果结果溢出long则抛出异常 |
static double | exp(double a) | 返回Euler的数字e,其值double值。 |
static double | expm1(double x) | 返回 e x -1。 |
static floor | floor(double a) | 返回小于或等于参数且等于数学整数的最大值(最接近正无穷大) double 。 |
static int | floorDiv(int x, int y) | 返回小于或等于代数商的最大值(最接近正无穷大) int 。 |
static long | floorDiv(long x, int y) | 返回小于或等于代数商的最大值(最接近正无穷大) long 。 |
static long | floorDiv(long x, long y) | 返回小于或等于代数商的最大值(最接近正无穷大) long 。 |
static int | floorMod(int x, int y) | 返回int参数的floor模数。 |
static int | floorMod(long x, int y) | 返回long和int参数的floor数。 |
static long | floorMod(long x,long y) | 返回long参数的floor模数。 |
static double | fma(double a, double b, double c) | 返回三个参数的融合乘法加法; 也就是说,返回与第三个参数相加的前两个参数的精确乘积,然后舍入一次到最接近的double 。 |
static float | fma(float a, float b, float c) | 返回三个参数的融合乘法加法; 也就是说,返回与第三个参数相加的前两个参数的精确乘积,然后舍入一次到最接近的float。 |
static int | getExponent(double d) | 返回 double 表示中使用的无偏指数。 |
static int | getExponent(float d) | 返回 float 表示中使用的无偏指数。 |
static double | hypot(double x, double y) | 返回sqrt( x 2 + y 2 ),没有中间溢出或下溢。 |
static double | IEEEremainder(double f1, double f2) | 根据IEEE 754标准规定,计算两个参数的余数运算。 |
static int | incrementExact(int a) | 返回以1递增的参数,如果结果溢出 |
static long | incrementExact(long a) | 返回以1递增的参数,如果结果溢出 long 则抛出异常。 |
static double | log(double a) | 返回 |
static double | log10(double a) | 返回 double 值的基数10对数。 |
static double | log1p(double x) | 返回参数和的总和的自然对数。 |
static double | max(double a, double b) | 返回两个double值中较大的double。 |
static float | max(float a, float b) | 返回两个float值中较大的float。 |
static int | max(int a, int b) | 返回两个int值中较大的int。 |
static long | max(long a, long b) | 返回两个long值中较大的long。 |
static double | min(double a, double b) | 返回两个double值中较小的double。 |
static float | min(float a, float b) | 返回两个float值中较小的float。 |
static int | min(int a, int b) | 返回两个int值中较小的int。 |
static long | min(long a, long b) | 返回两个long值中较小的long。 |
static int | multiplyExact(int x, int y) | 返回参数的乘积,如果结果溢出 |
static long | multiplyExact(long x, int y) | 返回参数的乘积,如果结果溢出 long 则抛出异常。 |
static long | multiplyExact(long x, long y) | 返回参数的乘积,如果结果溢出 long 则抛出异常。 |
static long | multiplyFull(int x, int y) | 返回参数的确切数学乘积。 |
static long | multiplyHigh(long x, long y) | 返回 |
static int | negateExact(int a) | 返回参数的否定,如果结果溢出 |
static long | negateExact(long a) | 返回参数的否定,如果结果溢出 int 则抛出异常。 |
static double | nextAfter(double start, double direction) | 返回第二个参数方向上第一个参数旁边的浮点数。 |
static float | nextAfter(float start, float direction) | 返回第二个参数方向上第一个参数旁边的浮点数。 |
static double | nextDown(double d) | 返回负无穷大方向上与 |
static float | nextDown(float f) | 返回负无穷大方向上与 f 相邻的浮点值。 |
static double | nextUp(double d) | 返回正无穷大方向上与 d 相邻的浮点值。 |
static float | nextUp(float f) | 返回正无穷大方向上与 f 相邻的浮点值。 |
static double | pow(double a, double b) | 返回第一个参数的值,该值是第二个参数的幂。 |
static double | random() | 返回带有正号的double值,大于或等于0.0且小于1.0。 |
static double | rint(double a) | 返回与 |
static long | round(double a) | 返回与参数最接近的 |
static int | round(float a) | 返回与参数最接近的 int,并将关系四舍五入为正无穷大。 |
static double | scalb(double d,int scaleFactor) | 返回 |
static float | scalb(flaot f,int scaleFactor) | 返回 f ×2 scaleFactor 舍入,就像通过单个正确舍入的浮点乘以浮点值集的成员一样。 |
static double | signum(double d) | 返回参数的signum函数; 如果参数为零,则为零;如果参数大于零,则为1.0;如果参数小于零,则为-1.0。 |
static float | signum(float f) | 返回参数的signum函数; 如果参数为零则为零,如果参数大于零则为1.0f,如果参数小于零则为-1.0f。 |
static double | sin(double a) | 返回角度的三角正弦值。 |
static double | sinh (double x) | 返回 |
static double | sqrt(double a) | 返回 |
static int | subtractExact(int x, int y) | 返回参数的差异,如果结果溢出 |
static long | subtractExact(long x, long y) | 返回参数的差异,如果结果溢出 |
static double | tan(double a) | 返回角度的三角正切。 |
static double | tanh(double x) | 返回 |
static double | toDegrees(double angrad) | 将以弧度测量的角度转换为以度为单位测量的近似等效角度。 |
static int | toIntExact(long value) | 返回 |
static double | toRadians(double angdeg) | 将以度为单位测量的角度转换为以弧度为单位测量的近似等效角度。 |
static double | upl(double d) | 返回参数的ulp大小。 |
static float | upl(flaot f) | 返回参数的ulp大小。 |
常用方法解析:
路漫漫其修远兮,吾将上下而求索!欢迎指正!