Math类继承Object类。
一、字段
- static double E
最接近e的数 - static double PI : π
二、方法
- 随机数 static double random() :返回带正好的double值,该值大于等于0.0且小于等于1.0。
- 平方根 static double sqrt(double a) :返回正确舍入的double值的平方根。
- 立方根 static double cbrt(double a) :返回a的立方根。
- 绝对值 abs
static double abs(double a) :返回double类型的a的绝对值
static float abs(float a) :返回float类型的a的绝对值
static int abs(int a):返回int类型的a的绝对值
static long abs(long a):返回long类型的a的绝对值 - 较大值 max
static double max(double a,double b) :返回 a,b中较大的值,double类型
static float max(float a,float b):返回 a,b中较大的值,float类型
static int max(int a,int b):返回 a,b中较大的值,int类型
static long max(long a,long b):返回 a,b中较大的值,long类型 - 较小值 min
static double min(double a,double b) :返回 a,b中较小的值,double类型
static float min(float a,float b):返回 a,b中较小的值,float类型
static int min(int a,int b):返回 a,b中较小的值,int类型
static long min(long a,long b):返回 a,b中较小的值,long类型 - 三角函数
static double sin(double a) : sin
static double cos(double a) : cos
static double tan(double a) : tan - 幂函数
static double exp(double a) : 返回e的a次幂值 - 对数函数
static double log(double a) : 底数是e
static double log10(double a) : 底数是10