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
doubles. |
static float |
max(float x,
float y)
Returns the larger of two
floats. |
static int |
max(int x,
int y)
Returns the larger of two
ints. |
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
doubles. |
static float |
min(float x,
float y)
Returns the smaller of two
floats. |
static int |
min(int x,
int y)
Returns the smaller of two
ints. |
static long |
min(long x,
long y)
Returns the smaller of two
longs. |
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 double abs(double x)
double.x - a doubledouble representing public static float abs(float x)
float.x - a floatfloat representing public static int abs(int x)
int.x - an intint representing public static long abs(long x)
long.x - a longlong representing public static double acos(double x)
double.x - a doubledouble representing the angle, in radians,
whose cosine is x.
It is in the range public static double asin(double x)
double.x - a doubledouble representing the angle, in radians,
whose sine is x.
It is in the range public static double atan(double x)
double.x - a doubledouble representing the angle, in radians,
whose tangent is x.
It is in the range 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 public static double ceil(double x)
double rounded toward
positive infinity to an integral value.x - a doubledouble, not less than x,
that is an integral valuepublic static double cos(double x)
double.x - a double, assumed to be in radiansdouble, the cosine of xpublic static double exp(double x)
double.
Special cases:
x - a double.double representing public static double floor(double x)
double rounded toward
negative infinity to an integral value.x - a doubledouble, not greater than 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 log(double x)
double.x - a doubledouble representing the natural (base e) logarithm of xpublic static double max(double x,
double y)
doubles.x - a doubley - a doubledouble, the larger of x and y.
This function considers -0.0 to
be less than 0.0.public static float max(float x,
float y)
floats.x - a floaty - a floatfloat, the larger of x and y.
This function considers -0.0f to
be less than 0.0f.public static int max(int x,
int y)
ints.x - an inty - an intint, the larger of x and ypublic static long max(long x,
long y)
longs.x - a longy - a longlong, the larger of x and ypublic static double min(double x,
double y)
doubles.x - a doubley - a doubledouble, the smaller of x and y.
This function considers -0.0 to
be less than 0.0.public static float min(float x,
float y)
floats.x - a floaty - a floatfloat, the smaller of x and y.
This function considers -0.0f to
be less than 0.0f.public static int min(int x,
int y)
ints.x - an inty - an intint representing the smaller of x and ypublic static long min(long x,
long y)
longs.x - a longy - a longlong, the smaller of x and ypublic static double pow(double x,
double y)
x - a double, the basey - a double, the exponentdouble, x to the power ypublic static double random()
double representing a random number from a
uniform distributionpublic static double rint(double x)
double rounded toward
the closest integral value.x - a doubledouble closest to x
that is an integral valuepublic static long round(double x)
long closest to a given double.x - a doublelong closest to xpublic static int round(float x)
float.x - a floatint closest to xpublic static double sin(double x)
double.x - a double, assumed to be in radiansdouble, the sine of xpublic static double sqrt(double x)
double.x - a doubledouble representing the square root of xpublic static double tan(double x)
double.x - a double, assumed to be in radiansdouble, the tangent of xCopyright © 1970-2015 Rogue Wave Software
Built June 18 2015.