DthingApi
Static Public Member Functions | Static Public Attributes | List of all members
java.lang.Math Class Reference

Static Public Member Functions

static double abs (double a)
 
static float abs (float a)
 
static int abs (int a)
 
static long abs (long a)
 
static double ceil (double d)
 
static native double cos (double d)
 
static double floor (double d)
 
static double max (double d1, double d2)
 
static float max (float f1, float f2)
 
static int max (int i1, int i2)
 
static long max (long l1, long l2)
 
static double min (double d1, double d2)
 
static float min (float f1, float f2)
 
static int min (int i1, int i2)
 
static long min (long l1, long l2)
 
static long round (double d)
 
static int round (float f)
 
static double signum (double d)
 
static float signum (float f)
 
static native double sin (double d)
 
static native double sqrt (double d)
 
static native double tan (double d)
 
static double toRadians (double angdeg)
 
static double toDegrees (double angrad)
 

Static Public Attributes

static final double E = 2.718281828459045
 
static final double PI = 3.141592653589793
 

Detailed Description

Class Math provides basic math constants and operations such as trigonometric functions, hyperbolic functions, exponential, logarithms, etc.

Member Function Documentation

◆ abs() [1/4]

static double java.lang.Math.abs ( double  a)
inlinestatic

Returns the absolute value of the argument.

Special cases:

  • abs(-0.0) = +0.0
  • abs(+infinity) = +infinity
  • abs(-infinity) = +infinity
  • abs(NaN) = NaN
Parameters
dthe value whose absolute value has to be computed.
Returns
the absolute value of the argument.

◆ abs() [2/4]

static float java.lang.Math.abs ( float  a)
inlinestatic

Returns the absolute value of the argument.

Special cases:

  • abs(-0.0) = +0.0
  • abs(+infinity) = +infinity
  • abs(-infinity) = +infinity
  • abs(NaN) = NaN
Parameters
fthe value whose absolute value has to be computed.
Returns
the argument if it is positive, otherwise the negation of the argument.

◆ abs() [3/4]

static int java.lang.Math.abs ( int  a)
inlinestatic

Returns the absolute value of the argument.

If the argument is

Integer.MIN_VALUE

,

Integer.MIN_VALUE

is returned.

Parameters
ithe value whose absolute value has to be computed.
Returns
the argument if it is positive, otherwise the negation of the argument.

◆ abs() [4/4]

static long java.lang.Math.abs ( long  a)
inlinestatic

Returns the absolute value of the argument. If the argument is

Long.MIN_VALUE

,

Long.MIN_VALUE

is returned.

Parameters
lthe value whose absolute value has to be computed.
Returns
the argument if it is positive, otherwise the negation of the argument.

◆ ceil()

static double java.lang.Math.ceil ( double  d)
inlinestatic

Returns the double conversion of the most negative (closest to negative infinity) integer value which is greater than the argument.

Special cases:

  • ceil(+0.0) = +0.0
  • ceil(-0.0) = -0.0
  • ceil((anything in range (-1,0)) = -0.0
  • ceil(+infinity) = +infinity
  • ceil(-infinity) = -infinity
  • ceil(NaN) = NaN
Parameters
dthe value whose closest integer value has to be computed.
Returns
the ceiling of the argument.

◆ cos()

static native double java.lang.Math.cos ( double  d)
static

Returns the closest double approximation of the cosine of the argument. The returned result is within 1 ulp (unit in the last place) of the real result.

Special cases:

  • cos(+infinity) = NaN
  • cos(-infinity) = NaN
  • cos(NaN) = NaN
Parameters
dthe angle whose cosine has to be computed, in radians.
Returns
the cosine of the argument.

◆ floor()

static double java.lang.Math.floor ( double  d)
inlinestatic

Returns the double conversion of the most positive (closest to positive infinity) integer value which is less than the argument.

Special cases:

Parameters
dthe value whose closest integer value has to be computed.
Returns
the floor of the argument.

◆ max() [1/4]

static double java.lang.Math.max ( double  d1,
double  d2 
)
inlinestatic

Returns the most positive (closest to positive infinity) of the two arguments.

Special cases:

  • max(NaN, (anything)) = NaN
  • max((anything), NaN) = NaN
  • max(+0.0, -0.0) = +0.0
  • max(-0.0, +0.0) = +0.0
Parameters
d1the first argument.
d2the second argument.
Returns
the larger of
d1
and
d2
.

◆ max() [2/4]

static float java.lang.Math.max ( float  f1,
float  f2 
)
inlinestatic

Returns the most positive (closest to positive infinity) of the two arguments.

Special cases:

  • max(NaN, (anything)) = NaN
  • max((anything), NaN) = NaN
  • max(+0.0, -0.0) = +0.0
  • max(-0.0, +0.0) = +0.0
Parameters
f1the first argument.
f2the second argument.
Returns
the larger of
f1
and
f2
.

◆ max() [3/4]

static int java.lang.Math.max ( int  i1,
int  i2 
)
inlinestatic

Returns the most positive (closest to positive infinity) of the two arguments.

Parameters
i1the first argument.
i2the second argument.
Returns
the larger of
i1
and
i2
.

◆ max() [4/4]

static long java.lang.Math.max ( long  l1,
long  l2 
)
inlinestatic

Returns the most positive (closest to positive infinity) of the two arguments.

Parameters
l1the first argument.
l2the second argument.
Returns
the larger of
l1
and
l2
.

◆ min() [1/4]

static double java.lang.Math.min ( double  d1,
double  d2 
)
inlinestatic

Returns the most negative (closest to negative infinity) of the two arguments.

Special cases:

  • min(NaN, (anything)) = NaN
  • min((anything), NaN) = NaN
  • min(+0.0, -0.0) = -0.0
  • min(-0.0, +0.0) = -0.0
Parameters
d1the first argument.
d2the second argument.
Returns
the smaller of
d1
and
d2
.

◆ min() [2/4]

static float java.lang.Math.min ( float  f1,
float  f2 
)
inlinestatic

Returns the most negative (closest to negative infinity) of the two arguments.

Special cases:

  • min(NaN, (anything)) = NaN
  • min((anything), NaN) = NaN
  • min(+0.0, -0.0) = -0.0
  • min(-0.0, +0.0) = -0.0
Parameters
f1the first argument.
f2the second argument.
Returns
the smaller of
f1
and
f2
.

◆ min() [3/4]

static int java.lang.Math.min ( int  i1,
int  i2 
)
inlinestatic

Returns the most negative (closest to negative infinity) of the two arguments.

Parameters
i1the first argument.
i2the second argument.
Returns
the smaller of
i1
and
i2
.

◆ min() [4/4]

static long java.lang.Math.min ( long  l1,
long  l2 
)
inlinestatic

Returns the most negative (closest to negative infinity) of the two arguments.

Parameters
l1the first argument.
l2the second argument.
Returns
the smaller of
l1
and
l2
.

◆ round() [1/2]

static long java.lang.Math.round ( double  d)
inlinestatic

Returns the result of rounding the argument to an integer. The result is equivalent to

(long) Math.floor(d+0.5)

.

Special cases:

  • round(+0.0) = +0.0
  • round(-0.0) = +0.0
  • round((anything > Long.MAX_VALUE) = Long.MAX_VALUE
  • round((anything < Long.MIN_VALUE) = Long.MIN_VALUE
  • round(+infinity) = Long.MAX_VALUE
  • round(-infinity) = Long.MIN_VALUE
  • round(NaN) = +0.0
Parameters
dthe value to be rounded.
Returns
the closest integer to the argument.

◆ round() [2/2]

static int java.lang.Math.round ( float  f)
inlinestatic

Returns the result of rounding the argument to an integer. The result is equivalent to

(int) Math.floor(f+0.5)

.

Special cases:

  • round(+0.0) = +0.0
  • round(-0.0) = +0.0
  • round((anything > Integer.MAX_VALUE) = Integer.MAX_VALUE
  • round((anything < Integer.MIN_VALUE) = Integer.MIN_VALUE
  • round(+infinity) = Integer.MAX_VALUE
  • round(-infinity) = Integer.MIN_VALUE
  • round(NaN) = +0.0
Parameters
fthe value to be rounded.
Returns
the closest integer to the argument.

◆ signum() [1/2]

static double java.lang.Math.signum ( double  d)
inlinestatic

Returns the signum function of the argument. If the argument is less than zero, it returns -1.0. If the argument is greater than zero, 1.0 is returned. If the argument is either positive or negative zero, the argument is returned as result.

Special cases:

Parameters
dthe value whose signum has to be computed.
Returns
the value of the signum function.

◆ signum() [2/2]

static float java.lang.Math.signum ( float  f)
inlinestatic

Returns the signum function of the argument. If the argument is less than zero, it returns -1.0. If the argument is greater than zero, 1.0 is returned. If the argument is either positive or negative zero, the argument is returned as result.

Special cases:

Parameters
fthe value whose signum has to be computed.
Returns
the value of the signum function.

◆ sin()

static native double java.lang.Math.sin ( double  d)
static

Returns the closest double approximation of the sine of the argument. The returned result is within 1 ulp (unit in the last place) of the real result.

Special cases:

  • sin(+0.0) = +0.0
  • sin(-0.0) = -0.0
  • sin(+infinity) = NaN
  • sin(-infinity) = NaN
  • sin(NaN) = NaN
Parameters
dthe angle whose sin has to be computed, in radians.
Returns
the sine of the argument.

◆ sqrt()

static native double java.lang.Math.sqrt ( double  d)
static

Returns the closest double approximation of the square root of the argument.

Special cases:

  • sqrt(+0.0) = +0.0
  • sqrt(-0.0) = -0.0
  • sqrt( (anything < 0) ) = NaN
  • sqrt(+infinity) = +infinity
  • sqrt(NaN) = NaN
Parameters
dthe value whose square root has to be computed.
Returns
the square root of the argument.

◆ tan()

static native double java.lang.Math.tan ( double  d)
static

Returns the closest double approximation of the tangent of the argument. The returned result is within 1 ulp (unit in the last place) of the real result.

Special cases:

  • tan(+0.0) = +0.0
  • tan(-0.0) = -0.0
  • tan(+infinity) = NaN
  • tan(-infinity) = NaN
  • tan(NaN) = NaN
Parameters
dthe angle whose tangent has to be computed, in radians.
Returns
the tangent of the argument.

◆ toDegrees()

static double java.lang.Math.toDegrees ( double  angrad)
inlinestatic

Returns the measure in degrees of the supplied radian angle. The result is

angrad * 180 / pi

.

Special cases:

Parameters
angradan angle in radians.
Returns
the degree measure of the angle.

◆ toRadians()

static double java.lang.Math.toRadians ( double  angdeg)
inlinestatic

Returns the measure in radians of the supplied degree angle. The result is

angdeg / 180 * pi

.

Special cases:

Parameters
angdegan angle in degrees.
Returns
the radian measure of the angle.

Member Data Documentation

◆ E

final double java.lang.Math.E = 2.718281828459045
static

The double value closest to e, the base of the natural logarithm.

◆ PI

final double java.lang.Math.PI = 3.141592653589793
static

The double value closest to pi, the ratio of a circle's circumference to its diameter.


The documentation for this class was generated from the following file: