public final class Math extends Object
这类 Math包含用于执行基本的数字运算等基本指数、对数、平方根法、三角函数。不可继承。
成员变量
static double E
自然对数的基础。
static double PI
圆周率
常用的方法
取整函数主要有三种:ceil()、floor()、round()
ceil()
向上取整的时候,正数,则直接将当前整数加一;负数,则将整数后面的数据抹除;整数,则不变。
floor()
向下取整的时候,正数,则取其整数部位,抹除小数部位;负数,则取其整数加一;整数,则不变。
round()
四舍五入的时候,
正数,小数位大于5,则整数位加一,小数位小于5,则整数位不变,抹除小数位;
负数,小数位小于5,则整数位不变,抹除小数位,小数位大于5,则整数位加一;
整数,则不变。
==============================
所有方法
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到零圆周率。
static int addExact(int x, int y)
返回参数的总和,抛出一个异常,如果结果溢出一个 int。
static long addExact(long x, long y)
返回参数的总和,抛出一个异常,如果结果溢出 long。
static double asin(double a)
返回一个值的圆弧正弦;返回的角度范围在零圆周率/ 2通过空圆周率/ 2。
static double atan(double a)
返回一个值的反正切值;返回的角度范围在零圆周率/ 2通过空圆周率/ 2。
static double atan2(double y, double x)
返回从直角坐标转换角空θ( 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)
返回参数减一,抛出一个异常,如果结果溢出一个 int。
static long decrementExact(long a)
返回参数减一,抛出一个异常,如果结果溢出 long。
static double exp(double a)
返回欧拉数努尔提升到一 double价值动力。
static double expm1(double x)
返回nulle X - 1。
static double floor(double a)
收益最大(最接近正无穷大) double值小于或等于该参数等于数学整数。
static int floorDiv(int x, int y)
收益最大(最接近正无穷大) int值小于或等于代数商。
static long floorDiv(long x, long y)
收益最大(最接近正无穷大) long值小于或等于代数商。
static int floorMod(int x, int y)
返回参数的 int地板模数。
static long floorMod(long x, long y)
返回参数的 long地板模数。
static int getExponent(double d)
返回用于表示一个 double偏指数。
static int getExponent(float f)
返回用于表示一个 float偏指数。
static double hypot(double x, double y)
返回sqrt(nullx 二 + nully 二)没有中间的上溢或下溢。
static double IEEEremainder(double f1, double f2)
计算剩余操作两参数由IEEE 754标准规定。
static int incrementExact(int a)
返回参数递增1,抛出一个异常,如果结果溢出一个 int。
static long incrementExact(long a)
返回参数递增1,抛出一个异常,如果结果溢出 long。
static double log(double a)
收益率的自然对数(基地努尔)一 double价值。
static double log10(double a)
返回以10为底的对数的一 double价值。
static double log1p(double x)
返回参数和1的总和的自然对数。
static double max(double a, double b)
返回两个 double值越大。
static float max(float a, float b)
返回两个 float值越大。
static int max(int a, int b)
返回两个 int值越大。
static long max(long a, long b)
返回两个 long值越大。
static double min(double a, double b)
返回两个 double值较小。
static float min(float a, float b)
返回两个 float值较小。
static int min(int a, int b)
返回两个 int值较小。
static long min(long a, long b)
返回两个 long值较小。
static int multiplyExact(int x, int y)
返回参数的产品,抛出一个异常,如果结果溢出一个 int。
static long multiplyExact(long x, long y)
返回参数的产品,抛出一个异常,如果结果溢出 long。
static int negateExact(int a)
返回自变量的否定,抛出一个异常,如果结果溢出一个 int。
static long negateExact(long a)
返回自变量的否定,抛出一个异常,如果结果溢出 long。
static double nextAfter(double start, double direction)
返回在第二个参数的方向上与第一个参数相邻的浮点数。
static float nextAfter(float start, double direction)
返回在第二个参数的方向上与第一个参数相邻的浮点数。
static double nextDown(double d)
返回邻近 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)
返回 double值是在最接近的值的参数,相当于一个数学整数。
static long round(double a)
返回最近的 long的说法,与舍入到正无穷。
static int round(float a)
返回最近的 int的说法,与舍入到正无穷。
static double scalb(double d, int scaleFactor)
返回 d×2 scaleFactor圆润好像由一个单一的正确舍入的浮点乘法的双重价值的成员组。
static float scalb(float f, int scaleFactor)
返回 f×2 scaleFactor圆润好像由一个单一的正确舍入的浮点乘法的float值集成员。
static double signum(double d)
返回自变量的符号函数;零如果参数为零,1如果参数大于零,1如果参数小于零。
static float signum(float f)
返回自变量的符号函数;零如果参数为零,1.0f如果参数大于零,-1.0f如果参数小于零。
static double sin(double a)
返回一个角度的三角正弦。
static double sinh(double x)
返回一个 double的双曲正弦值。
static double sqrt(double a)
返回正平方根入一 double价值。
static int subtractExact(int x, int y)
返回参数的差异,抛出一个异常,如果结果溢出一个 int。
static long subtractExact(long x, long y)
返回参数的差异,抛出一个异常,如果结果溢出 long。
static double tan(double a)
返回一个角的三角切线。
static double tanh(double x)
返回一个 double的双曲正切值。
static double toDegrees(double angrad)
将一个测量角度弧度近似等效的角度衡量度。
static int toIntExact(long value)
返回的 long参数的值;抛出一个异常,如果值溢出一个 int。
static double toRadians(double angdeg)
转换一个角度衡量度的近似等效用弧度测量的角。
static double ulp(double d)
返回一个小规模的争论。
static float ulp(float f)
返回一个小规模的争论。