java.lang
public
final
class
java.lang.StrictMath
Class StrictMath provides various numeric operations using the standards set
by the known "Freely Distributable Math Library" (fdlibm). The standard is
set by the January 4th, 1995 version of the library.
Summary
Constants
| |
|
|
Value |
|
| double |
E |
Standard math constant
|
2.718281828459045 |
| double |
PI |
Standard math constant
|
3.141592653589793 |
Public Methods
| |
|
|
static |
double |
IEEEremainder(double d1, double d2) |
| |
|
|
static |
float |
abs(float f) |
| |
|
|
static |
long |
abs(long l) |
| |
|
|
static |
int |
abs(int i) |
| |
|
|
static |
double |
abs(double d) |
| |
|
|
static |
double |
acos(double d) |
| |
|
|
static |
double |
asin(double d) |
| |
|
|
static |
double |
atan(double d) |
| |
|
|
static |
double |
atan2(double d1, double d2) |
| |
|
|
static |
double |
cbrt(double d) |
| |
|
|
static |
double |
ceil(double d) |
| |
|
|
static |
double |
cos(double d) |
| |
|
|
static |
double |
cosh(double d) |
| |
|
|
static |
double |
exp(double d) |
| |
|
|
static |
double |
expm1(double d) |
| |
|
|
static |
double |
floor(double d) |
| |
|
|
static |
double |
hypot(double x, double y) |
| |
|
|
static |
double |
log(double d) |
| |
|
|
static |
double |
log10(double d) |
| |
|
|
static |
double |
log1p(double d) |
| |
|
|
static |
double |
max(double d1, double d2) |
| |
|
|
static |
int |
max(int i1, int i2) |
| |
|
|
static |
float |
max(float f1, float f2) |
| |
|
|
static |
long |
max(long l1, long l2) |
| |
|
|
static |
double |
min(double d1, double d2) |
| |
|
|
static |
long |
min(long l1, long l2) |
| |
|
|
static |
float |
min(float f1, float f2) |
| |
|
|
static |
int |
min(int i1, int i2) |
| |
|
|
static |
double |
pow(double d1, double d2) |
| |
|
|
static |
double |
random() |
| |
|
|
static |
double |
rint(double d) |
| |
|
|
static |
long |
round(double d) |
| |
|
|
static |
int |
round(float f) |
| |
|
|
static |
double |
signum(double d) |
| |
|
|
static |
float |
signum(float f) |
| |
|
|
static |
double |
sin(double d) |
| |
|
|
static |
double |
sinh(double d) |
| |
|
|
static |
double |
sqrt(double d) |
| |
|
|
static |
double |
tan(double d) |
| |
|
|
static |
double |
tanh(double d) |
| |
|
|
static |
double |
toDegrees(double angrad) |
| |
|
|
static |
double |
toRadians(double angdeg) |
| |
|
|
static |
float |
ulp(float f) |
| |
|
|
static |
double |
ulp(double d) |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
double
E
Standard math constant
Constant Value:
2.718281828459045
public
static
final
double
PI
Standard math constant
Constant Value:
3.141592653589793
Public Methods
public
static
double
IEEEremainder(double d1, double d2)
Answers the remainder of dividing the first argument by the second using
the IEEE 754 rules.
Parameters
| d1
| the numerator of the operation |
| d2
| the denominator of the operation |
public
static
float
abs(float f)
Answers the absolute value of the argument.
Parameters
| f
| the value to be converted |
Returns
- the argument if it is positive, otherwise the negation of the
argument.
public
static
long
abs(long l)
Answers the absolute value of the argument.
Parameters
| l
| the value to be converted |
Returns
- the argument if it is positive, otherwise the negation of the
argument.
public
static
int
abs(int i)
Answers the absolute value of the argument.
Parameters
| i
| the value to be converted |
Returns
- the argument if it is positive, otherwise the negation of the
argument.
public
static
double
abs(double d)
Answers the absolute value of the argument.
Parameters
| d
| the value to be converted |
Returns
- the argument if it is positive, otherwise the negation of the
argument.
public
static
double
acos(double d)
Answers the closest double approximation of the arc cosine of the
argument
Parameters
| d
| the value to compute acos of |
Returns
- the arc cosine of the argument.
public
static
double
asin(double d)
Answers the closest double approximation of the arc sine of the argument
Parameters
| d
| the value to compute asin of |
Returns
- the arc sine of the argument.
public
static
double
atan(double d)
Answers the closest double approximation of the arc tangent of the
argument
Parameters
| d
| the value to compute atan of |
Returns
- the arc tangent of the argument.
public
static
double
atan2(double d1, double d2)
Answers the closest double approximation of the arc tangent of the result
of dividing the first argument by the second argument.
Parameters
| d1
| the numerator of the value to compute atan of |
| d2
| the denominator of the value to compute atan of |
Returns
- the arc tangent of d1/d2.
public
static
double
cbrt(double d)
Answers the closest double approximation of the cube root of the
argument.
Parameters
| d
| the value to compute cube root of |
Returns
- the cube root of the argument.
public
static
double
ceil(double d)
Answers the double conversion of the most negative (i.e. closest to
negative infinity) integer value which is greater than the argument.
Parameters
| d
| the value to be converted |
Returns
- the ceiling of the argument.
public
static
double
cos(double d)
Answers the closest double approximation of the cosine of the argument
Parameters
| d
| the value to compute cos of |
Returns
- the cosine of the argument.
public
static
double
cosh(double d)
Answers the closest double approximation of the hyperbolic cosine of the
argument.
Parameters
| d
| the value to compute hyperbolic cosine of |
Returns
- the hyperbolic cosine of the argument.
public
static
double
exp(double d)
Answers the closest double approximation of the raising "e" to the power
of the argument
Parameters
| d
| the value to compute the exponential of |
Returns
- the exponential of the argument.
public
static
double
expm1(double d)
Answers the closest double approximation of
ed - 1.
If the argument is very close to 0, it is much more accurate to use
expm1(d)+1 than exp(d).
Parameters
| d
| the value to compute the ed - 1 of |
Returns
- the ed - 1 value of the argument.
public
static
double
floor(double d)
Answers the double conversion of the most positive (i.e. closest to
positive infinity) integer value which is less than the argument.
Parameters
| d
| the value to be converted |
Returns
- the ceiling of the argument.
public
static
double
hypot(double x, double y)
Answers sqrt(
x2+
y2). The
final result is without medium underflow or overflow.
Parameters
| x
| a double number |
| y
| a double number |
Returns
- the sqrt(x2+y2) value
of the arguments.
public
static
double
log(double d)
Answers the closest double approximation of the natural logarithm of the
argument
Parameters
| d
| the value to compute the log of |
Returns
- the natural logarithm of the argument.
public
static
double
log10(double d)
Answers the logarithm of the argument and the base is 10.
Parameters
| d
| the value to compute the base 10 log of |
Returns
- the base 10 logarithm of the argument.
public
static
double
log1p(double d)
Answers the closest double approximation of the natural logarithm of the
sum of the argument and 1. If the argument is very close to 0, it is much
more accurate to use log1p(d) than log(1.0+d).
Parameters
| d
| the value to compute the ln(1+d) of |
Returns
- the natural logarithm of the sum of the argument and 1.
public
static
double
max(double d1, double d2)
Answers the most positive (i.e. closest to positive infinity) of the two
arguments.
Parameters
| d1
| the first argument to check |
| d2
| the second argument |
public
static
int
max(int i1, int i2)
Answers the most positive (i.e. closest to positive infinity) of the two
arguments.
Parameters
| i1
| the first argument to check |
| i2
| the second argument |
public
static
float
max(float f1, float f2)
Answers the most positive (i.e. closest to positive infinity) of the two
arguments.
Parameters
| f1
| the first argument to check |
| f2
| the second argument |
public
static
long
max(long l1, long l2)
Answers the most positive (i.e. closest to positive infinity) of the two
arguments.
Parameters
| l1
| the first argument to check |
| l2
| the second argument |
public
static
double
min(double d1, double d2)
Answers the most negative (i.e. closest to negative infinity) of the two
arguments.
Parameters
| d1
| the first argument to check |
| d2
| the second argument |
Returns
- the smaller of d1 and d2.
public
static
long
min(long l1, long l2)
Answers the most negative (i.e. closest to negative infinity) of the two
arguments.
Parameters
| l1
| the first argument to check |
| l2
| the second argument |
Returns
- the smaller of l1 and l2.
public
static
float
min(float f1, float f2)
Answers the most negative (i.e. closest to negative infinity) of the two
arguments.
Parameters
| f1
| the first argument to check |
| f2
| the second argument |
Returns
- the smaller of f1 and f2.
public
static
int
min(int i1, int i2)
Answers the most negative (i.e. closest to negative infinity) of the two
arguments.
Parameters
| i1
| the first argument to check |
| i2
| the second argument |
Returns
- the smaller of i1 and i2.
public
static
double
pow(double d1, double d2)
Answers the closest double approximation of the result of raising the
first argument to the power of the second.
Parameters
| d1
| the base of the operation. |
| d2
| the exponent of the operation. |
public
static
double
random()
Returns a pseudo-random number between 0.0 and 1.0.
public
static
double
rint(double d)
Answers the double conversion of the result of rounding the argument to
an integer.
Parameters
| d
| the value to be converted |
Returns
- the closest integer to the argument (as a double).
public
static
long
round(double d)
Answers the result of rounding the argument to an integer.
Parameters
| d
| the value to be converted |
Returns
- the closest integer to the argument.
public
static
int
round(float f)
Answers the result of rounding the argument to an integer.
Parameters
| f
| the value to be converted |
Returns
- the closest integer to the argument.
public
static
double
signum(double d)
Answers the signum function of the argument. If the argument is less than
zero, it answers -1.0. If greater than zero, 1.0 is returned. It returns
zero if the argument is also zero.
Parameters
| d
| the value to compute signum function of |
Returns
- the value of the signum function.
public
static
float
signum(float f)
Answers the signum function of the argument. If the argument is less than
zero, it answers -1.0. If greater than zero, 1.0 is returned. It returns
zero if the argument is also zero.
Parameters
| f
| the value to compute signum function of |
Returns
- the value of the signum function.
public
static
double
sin(double d)
Answers the closest double approximation of the sine of the argument
Parameters
| d
| the value to compute sin of |
Returns
- the sine of the argument.
public
static
double
sinh(double d)
Answers the closest double approximation of the hyperbolic sine of the
argument.
Parameters
| d
| the value to compute hyperbolic sine of |
Returns
- the hyperbolic sine of the argument.
public
static
double
sqrt(double d)
Answers the closest double approximation of the square root of the
argument
Parameters
| d
| the value to compute sqrt of |
Returns
- the square root of the argument.
public
static
double
tan(double d)
Answers the closest double approximation of the tangent of the argument
Parameters
| d
| the value to compute tan of |
Returns
- the tangent of the argument.
public
static
double
tanh(double d)
Answers the closest double approximation of the hyperbolic tangent of the
argument. The absolute value is always less than 1.
Parameters
| d
| the value to compute hyperbolic tangent of |
Returns
- the hyperbolic tangent of the argument.
public
static
double
toDegrees(double angrad)
Returns the measure in degrees of the supplied radian angle
Parameters
| angrad
| an angle in radians |
Returns
- the degree measure of the angle.
public
static
double
toRadians(double angdeg)
Returns the measure in radians of the supplied degree angle
Parameters
| angdeg
| an angle in degrees |
Returns
- the radian measure of the angle.
public
static
float
ulp(float f)
Answers the argument's ulp. The size of a ulp of a float value is the
positive distance between this value and the float value next larger
in magnitude. For non-NaN x, ulp(-x) == ulp(x).
Parameters
| f
| the floating-point value to compute ulp of |
Returns
- the size of a ulp of the argument.
public
static
double
ulp(double d)
Answers the argument's ulp. The size of a ulp of a double value is the
positive distance between this value and the double value next larger
in magnitude. For non-NaN x, ulp(-x) == ulp(x).
Parameters
| d
| the floating-point value to compute ulp of |
Returns
- the size of a ulp of the argument.