public final class JMath extends Object
Modifier and Type | Method and Description |
---|---|
static double |
abs(double x)
Returns the absolute value of a
double . |
static float |
abs(float x)
Returns the absolute value of a
float . |
static int |
abs(int x)
Returns the absolute value of an
int . |
static long |
abs(long x)
Returns the absolute value of a
long . |
static double |
acos(double x)
Returns the inverse (arc) cosine of a
double . |
static double |
asin(double x)
Returns the inverse (arc) sine of a
double . |
static double |
atan(double x)
Returns the inverse (arc) tangent of a
double . |
static double |
atan2(double y,
double x)
Returns the angle corresponding to a Cartesian point.
|
static double |
ceil(double x)
Returns the value of a
double rounded toward
positive infinity to an integral value. |
static double |
cos(double x)
Returns the cosine of a
double . |
static double |
exp(double x)
Returns the exponential of a
double . |
static double |
floor(double x)
Returns the value of a
double rounded toward
negative infinity to an integral value. |
static double |
IEEEremainder(double x,
double p)
Returns the IEEE remainder from x divided by p.
|
static double |
log(double x)
Returns the natural logarithm of a
double . |
static double |
max(double x,
double y)
Returns the larger of two
double s. |
static float |
max(float x,
float y)
Returns the larger of two
float s. |
static int |
max(int x,
int y)
Returns the larger of two
int s. |
static long |
max(long x,
long y)
Returns the larger of two
longs . |
static double |
min(double x,
double y)
Returns the smaller of two
double s. |
static float |
min(float x,
float y)
Returns the smaller of two
float s. |
static int |
min(int x,
int y)
Returns the smaller of two
int s. |
static long |
min(long x,
long y)
Returns the smaller of two
long s. |
static double |
pow(double x,
double y)
Returns x to the power y.
|
static double |
random()
Returns a random number from a uniform distribution.
|
static double |
rint(double x)
Returns the value of a
double rounded toward
the closest integral value. |
static long |
round(double x)
Returns the
long closest to a given double . |
static int |
round(float x)
Returns the integer closest to a given
float . |
static double |
sin(double x)
Returns the sine of a
double . |
static double |
sqrt(double x)
Returns the square root of a
double . |
static double |
tan(double x)
Returns the tangent of a
double . |
public static int abs(int x)
int
.x
- an int
int
representing \(|x|\).public static long abs(long x)
long
.x
- a long
long
representing \(|x|\).public static float abs(float x)
float
.x
- a float
float
representing \(|x|\).public static double abs(double x)
double
.x
- a double
double
representing \(|x|\).public static int min(int x, int y)
int
s.x
- an int
y
- an int
int
representing the smaller of x and ypublic static long min(long x, long y)
long
s.x
- a long
y
- a long
long
, the smaller of x and ypublic static float min(float x, float y)
float
s.x
- a float
y
- a float
float
, the smaller of x and y.
This function considers -0.0f to
be less than 0.0f.public static double min(double x, double y)
double
s.x
- a double
y
- a double
double
, the smaller of x and y.
This function considers -0.0 to
be less than 0.0.public static int max(int x, int y)
int
s.x
- an int
y
- an int
int
, the larger of x and ypublic static long max(long x, long y)
longs
.x
- a long
y
- a long
long
, the larger of x and ypublic static float max(float x, float y)
float
s.x
- a float
y
- a float
float
, the larger of x and y.
This function considers -0.0f to
be less than 0.0f.public static double max(double x, double y)
double
s.x
- a double
y
- a double
double
, the larger of x and y.
This function considers -0.0 to
be less than 0.0.public static int round(float x)
float
.x
- a float
int
closest to xpublic static long round(double x)
long
closest to a given double
.x
- a double
long
closest to xpublic static double random()
double
representing a random number from a
uniform distributionpublic static double ceil(double x)
double
rounded toward
positive infinity to an integral value.x
- a double
double
, not less than x,
that is an integral valuepublic static double floor(double x)
double
rounded toward
negative infinity to an integral value.x
- a double
double
, not greater than x,
that is an integral valuepublic static double rint(double x)
double
rounded toward
the closest integral value.x
- a double
double
closest to x
that is an integral valuepublic static double IEEEremainder(double x, double p)
x
- a double
, the dividendp
- a double
, the divisordouble
representing the remainder computed
according to the IEEE 754 standard.public static double sqrt(double x)
double
.x
- a double
double
representing the square root of xpublic static double exp(double x)
double
.
Special cases:
\(e^{\infty}\) is \(\infty\), \(e^{\rm {NaN}}\) is NaN;
\(e^{-\infty}\) is 0, and
for finite argument, only \(e^0 = 1\) is exact.x
- a double
.double
representing \(e^x\).public static double log(double x)
double
.x
- a double
double
representing the natural (base e) logarithm of xpublic static double sin(double x)
double
.x
- a double
, assumed to be in radiansdouble
, the sine of xpublic static double cos(double x)
double
.x
- a double
, assumed to be in radiansdouble
, the cosine of xpublic static double tan(double x)
double
.x
- a double
, assumed to be in radiansdouble
, the tangent of xpublic static double asin(double x)
double
.x
- a double
double
representing the angle, in radians,
whose sine is x.
It is in the range \([-\pi / 2, \pi / 2]\).public static double acos(double x)
double
.x
- a double
double
representing the angle, in radians,
whose cosine is x.
It is in the range \([0, \pi]\).public static double atan(double x)
double
.x
- a double
double
representing the angle, in radians,
whose tangent is x.
It is in the range \([-\pi / 2, \pi / 2]\).public static double atan2(double y, double x)
x
- a double
, the first argumenty
- a double
, the second argumentdouble
representing the angle, in radians,
the the line from (0,0) to (x,y) makes with the x-axis.
It is in the range \([-\pi, \pi]\).public static double pow(double x, double y)
x
- a double
, the basey
- a double
, the exponentdouble
, x to the power yCopyright © 2020 Rogue Wave Software. All rights reserved.