public final class Math extends Object
Modifier and Type | Field and Description |
---|---|
static double |
E
The most accurate approximation to the mathematical constant e:
2.718281828459045 . |
static double |
PI
The most accurate approximation to the mathematical constant pi:
3.141592653589793 . |
Constructor and Description |
---|
Math() |
Modifier and Type | Method and Description |
---|---|
static double |
abs(double val)
Returns the absolute value of a double value.
|
static float |
abs(float val)
Returns the absolute value of a float value.
|
static int |
abs(int val)
Returns the absolute value of a int value.
|
static long |
abs(long val)
Returns the absolute value of a long value.
|
static double |
acos(double val)
Returns the arc cosine of an angle, in the range of 0.0 through pi.
|
static double |
asin(double val)
Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
|
static double |
atan(double val)
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
|
static double |
atan2(double a,
double b)
Converts rectangular coordinates (b, a) to polar (r, theta).
|
static double |
ceil(double val)
Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer.
|
static double |
cos(double val)
Returns the trigonometric cosine of an angle.
|
static double |
exp(double val)
Returns the exponential number e (i.e., 2.718...) raised to the power of a double value.
|
static double |
floor(double val)
Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer.
|
static double |
IEEEremainder(double f1,
double f2)
Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
|
static double |
log(double val)
Returns the natural logarithm (base e) of a double value.
|
static double |
max(double a,
double b)
Returns the greater of two values.
|
static float |
max(float a,
float b)
Returns the greater of two values.
|
static int |
max(int a,
int b)
Returns the greater of two values.
|
static long |
max(long a,
long b)
Returns the greater of two values.
|
static double |
min(double a,
double b)
Returns the smaller of two values.
|
static float |
min(float a,
float b)
Returns the smaller of two values.
|
static int |
min(int a,
int b)
Returns the smaller of two values.
|
static long |
min(long a,
long b)
Returns the smaller of two values.
|
static double |
pow(double a,
double b)
Returns of value of the first argument raised to the power of the second argument.
|
static double |
random()
Returns a random number between 0.0 and 1.0.
|
static double |
rint(double value)
returns the closest integer to the argument.
|
static long |
round(double value)
Returns the closest long to the argument.
|
static int |
round(float value)
Returns the closest int to the argument.
|
static double |
sin(double val)
Returns the trigonometric sine of an angle.
|
static double |
sqrt(double val)
Returns the square root of a double value.
|
static double |
tan(double val)
Returns the trigonometric tangent of an angle.
|
public static final double E
2.718281828459045
. Used in natural log and exp.log(double)
,
exp(double)
,
Constant Field Valuespublic static final double PI
3.141592653589793
. This is the ratio of a circle's diameter
to its circumference.public static double abs(double val)
public static float abs(float val)
public static int abs(int val)
public static long abs(long val)
public static double acos(double val)
public static double asin(double val)
public static double atan(double val)
public static double atan2(double a, double b)
public static double ceil(double val)
public static double cos(double val)
public static double exp(double val)
public static double floor(double val)
public static double IEEEremainder(double f1, double f2)
public static double log(double val)
public static double max(double a, double b)
public static double min(double a, double b)
public static float max(float a, float b)
public static float min(float a, float b)
public static int max(int a, int b)
public static int min(int a, int b)
public static long max(long a, long b)
public static long min(long a, long b)
public static double pow(double a, double b)
public static double random()
public static double rint(double value)
public static long round(double value)
public static int round(float value)
public static double sin(double val)
public static double sqrt(double val)
public static double tan(double val)