Android
java.lang
public final class

java.lang.StrictMath

java.lang.Object
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)
Returns the remainder of dividing the first argument by the second using the IEEE 754 rules.
      static    float  abs(float f)
Returns the absolute value of the argument.
      static    long  abs(long l)
Returns the absolute value of the argument.
      static    int  abs(int i)
Returns the absolute value of the argument.
      static    double  abs(double d)
Returns the absolute value of the argument.
      static    double  acos(double d)
Returns the closest double approximation of the arc cosine of the argument
      static    double  asin(double d)
Returns the closest double approximation of the arc sine of the argument
      static    double  atan(double d)
Returns the closest double approximation of the arc tangent of the argument
      static    double  atan2(double d1, double d2)
Returns the closest double approximation of the arc tangent of the result of dividing the first argument by the second argument.
      static    double  cbrt(double d)
Returns the closest double approximation of the cube root of the argument.
      static    double  ceil(double d)
Returns the double conversion of the most negative (i.e.
      static    double  cos(double d)
Returns the closest double approximation of the cosine of the argument
      static    double  cosh(double d)
Returns the closest double approximation of the hyperbolic cosine of the argument.
      static    double  exp(double d)
Returns the closest double approximation of the raising "e" to the power of the argument
      static    double  expm1(double d)
Returns the closest double approximation of ed - 1.
      static    double  floor(double d)
Returns the double conversion of the most positive (i.e.
      static    double  hypot(double x, double y)
Returns sqrt(x2+y2).
      static    double  log(double d)
Returns the closest double approximation of the natural logarithm of the argument
      static    double  log10(double d)
Returns the logarithm of the argument and the base is 10.
      static    double  log1p(double d)
Returns the closest double approximation of the natural logarithm of the sum of the argument and 1.
      static    double  max(double d1, double d2)
Returns the most positive (i.e.
      static    int  max(int i1, int i2)
Returns the most positive (i.e.
      static    float  max(float f1, float f2)
Returns the most positive (i.e.
      static    long  max(long l1, long l2)
Returns the most positive (i.e.
      static    double  min(double d1, double d2)
Returns the most negative (i.e.
      static    long  min(long l1, long l2)
Returns the most negative (i.e.
      static    float  min(float f1, float f2)
Returns the most negative (i.e.
      static    int  min(int i1, int i2)
Returns the most negative (i.e.
      static    double  pow(double d1, double d2)
Returns the closest double approximation of the result of raising the first argument to the power of the second.
      static    double  random()
Returns a pseudo-random number between 0.0 and 1.0.
      static    double  rint(double d)
Returns the double conversion of the result of rounding the argument to an integer.
      static    long  round(double d)
Returns the result of rounding the argument to an integer.
      static    int  round(float f)
Returns the result of rounding the argument to an integer.
      static    double  signum(double d)
Returns the signum function of the argument.
      static    float  signum(float f)
Returns the signum function of the argument.
      static    double  sin(double d)
Returns the closest double approximation of the sine of the argument
      static    double  sinh(double d)
Returns the closest double approximation of the hyperbolic sine of the argument.
      static    double  sqrt(double d)
Returns the closest double approximation of the square root of the argument
      static    double  tan(double d)
Returns the closest double approximation of the tangent of the argument
      static    double  tanh(double d)
Returns the closest double approximation of the hyperbolic tangent of the argument.
      static    double  toDegrees(double angrad)
Returns the measure in degrees of the supplied radian angle
      static    double  toRadians(double angdeg)
Returns the measure in radians of the supplied degree angle
      static    float  ulp(float f)
Returns the argument's ulp.
      static    double  ulp(double d)
Returns the argument's ulp.
Methods inherited from class java.lang.Object

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)

Returns 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

Returns

  • the result of d1/d2.

public static float abs(float f)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

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

Parameters

d1 the first argument to check
d2 the second argument

Returns

  • the larger of d1 and d2.

public static int max(int i1, int i2)

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

Parameters

i1 the first argument to check
i2 the second argument

Returns

  • the larger of i1 and i2.

public static float max(float f1, float f2)

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

Parameters

f1 the first argument to check
f2 the second argument

Returns

  • the larger of f1 and f2.

public static long max(long l1, long l2)

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

Parameters

l1 the first argument to check
l2 the second argument

Returns

  • the larger of l1 and l2.

public static double min(double d1, double d2)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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.

Returns

  • d1 to the power of d2

public static double random()

Returns a pseudo-random number between 0.0 and 1.0.

Returns

  • a pseudo-random number

public static double rint(double d)

Returns 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)

Returns 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)

Returns 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)

Returns the signum function of the argument. If the argument is less than zero, it returns -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)

Returns the signum function of the argument. If the argument is less than zero, it returns -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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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)

Returns 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.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56