public final class Math extends Object
Modifier and Type | Field and Description |
---|---|
static double |
E
E
|
static double |
LN10
LN10
|
static double |
LN10E
LN10E
|
static double |
LN2
LN2
|
static double |
LN2E
LN2E
|
static double |
PI
PI
|
static double |
SQRT1_2
SQRT1_2
|
static double |
SQRT2
SQRT2
|
Modifier and Type | Method and Description |
---|---|
static double |
abs(double x)
The Math.abs() function returns the absolute value of a number.
|
static float |
abs(float x)
The Math.abs() function returns the absolute value of a number.
|
static int |
abs(int x)
The Math.abs() function returns the absolute value of a number.
|
static long |
abs(long x)
The Math.abs() function returns the absolute value of a number.
|
static double |
acos(double x)
The Math.acos() method returns a numeric value between 0 and π radians for x
between -1 and 1.
|
static double |
asin(double x)
The Math.asin() method returns a numeric value between - π/2 and π/2 radians
for x between -1 and 1.
|
static double |
atan(double x)
The Math.atan() method returns a numeric value between - π/2 and π/2 radians.
|
static double |
atan2(double y,
double x)
The Math.atan2() method returns a numeric value between -π and π representing the
angle theta of an (x, y) point.
|
static double |
ceil(double x)
The Math.ceil() function returns the smallest integer greater than
or equal to a given number.
|
static double |
cos(double x)
The Math.cos() method returns a numeric value between -1 and 1, which
represents the cosine of the angle.
|
static double |
exp(double x)
The Math.exp() function returns e raised to x, where x is the argument, and e
is Euler's number (also known as Napier's constant), the base of the natural logarithms.
|
static double |
floor(double x)
The Math.floor() function returns the largest integer less than
or equal to a given number.
|
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 x)
The Math.log() function returns the natural logarithm (base e) of a number.
|
static double |
log10(double x)
The Math.log10() function returns the base 10 logarithm of a number.
|
static double |
max(double a,
double b)
The Math.max() function returns the largest of two numbers.
|
static float |
max(float a,
float b)
The Math.max() function returns the largest of two numbers.
|
static int |
max(int a,
int b)
The Math.max() function returns the largest of two numbers.
|
static long |
max(long a,
long b)
The Math.max() function returns the largest of two numbers.
|
static double |
min(double a,
double b)
The Math.min() function returns the smallest of two numbers.
|
static float |
min(float a,
float b)
The Math.min() function returns the smallest of two numbers.
|
static int |
min(int a,
int b)
The Math.min() function returns the smallest of two numbers.
|
static long |
min(long a,
long b)
The Math.min() function returns the smallest of two numbers.
|
static double |
pow(double a,
double b)
The Math.pow() function returns the base to the exponent power.
|
static double |
random()
The Math.random() function returns a floating-point, pseudo-random number
in the range [0, 1) that is, from 0 (inclusive) up to but not
including 1 (exclusive), which you can then scale to your desired range.
|
static long |
round(double d)
The Math.round() function returns the value of a number rounded to the
nearest integer.
|
static int |
round(float x)
The Math.round() function returns the value of a number rounded to the
nearest integer.
|
static double |
sin(double x)
The Math.sin() method returns a numeric value between -1 and 1, which
represents the sine of the angle given in radians.
|
static double |
sqrt(double x)
The Math.sqrt() function returns the square root of a number.
|
static double |
tan(double x)
The Math.tan() method returns a numeric value that represents the tangent of
the angle.
|
public static final double E
public static final double PI
public static final double LN10
public static final double LN2
public static final double LN10E
public static final double LN2E
public static final double SQRT1_2
public static final double SQRT2
public static double abs(double x)
x
- a numberpublic static float abs(float x)
x
- a numberpublic static int abs(int x)
x
- a numberpublic static long abs(long x)
x
- a numberpublic static double ceil(double x)
x
- a numberpublic static double floor(double x)
x
- a numberpublic static double max(double a, double b)
a
- a numberb
- a numberpublic static float max(float a, float b)
a
- a numberb
- a numberpublic static int max(int a, int b)
a
- a numberb
- a numberpublic static long max(long a, long b)
a
- a numberb
- a numberpublic static double min(double a, double b)
a
- a numberb
- a numberpublic static float min(float a, float b)
a
- a numberb
- a numberpublic static int min(int a, int b)
a
- a numberb
- a numberpublic static long min(long a, long b)
a
- a numberb
- a numberpublic static double random()
public static long round(double d)
d
- a numberpublic static int round(float x)
x
- a numberpublic static double sqrt(double x)
x
- a numberpublic static double sin(double x)
x
- an angle (in radians)public static double cos(double x)
x
- an angle (in radians)public static double tan(double x)
x
- an angle (in radians)public static double asin(double x)
x
- a number between -1 and 1 (inclusive)public static double acos(double x)
x
- a number between -1 and 1 (inclusive)public static double atan(double x)
x
- a numberpublic static double atan2(double y, double x)
x
- x ordinatey
- y ordinatepublic static double pow(double a, double b)
a
- the baseb
- the exponentpublic static double exp(double x)
x
- a numberpublic static double log(double x)
x
- a numberpublic static double log10(double x)
x
- a numberpublic static double IEEEremainder(double f1, double f2)
f1 - f2
× n,
where n is the mathematical integer closest to the exact
mathematical value of the quotient f1/f2
, and if two
mathematical integers are equally close to f1/f2
,
then n is the integer that is even. If the remainder is
zero, its sign is the same as the sign of the first argument.
Special cases:
f1
- the dividend.f2
- the divisor.f1
is divided by
f2
.