Save This Page
Home » openjdk-7 » java » lang » [javadoc | source]
java.lang
class: VMMath [javadoc | source]
java.lang.Object
   java.lang.VMMath
Method from java.lang.VMMath Summary:
IEEEremainder,   acos,   asin,   atan,   atan2,   cbrt,   ceil,   cos,   cosh,   exp,   expm1,   floor,   hypot,   log,   log10,   log1p,   pow,   rint,   sin,   sinh,   sqrt,   tan,   tanh
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.lang.VMMath Detail:
 public static native double IEEEremainder(double x,
    double y)
    Get the IEEE 754 floating point remainder on two numbers. This is the value of x - y * n, where n is the closest double to x / y (ties go to the even n); for a zero remainder, the sign is that of x. If either argument is NaN, the first argument is infinite, or the second argument is zero, the result is NaN; if x is finite but y is infinite, the result is x. This is accurate within the limits of doubles.
 public static native double acos(double a)
    The trigonometric function arccos. The range of angles returned is 0 to pi radians (0 to 180 degrees). If the argument is NaN or its absolute value is beyond 1, the result is NaN. This is accurate within 1 ulp, and is semi-monotonic.
 public static native double asin(double a)
    The trigonometric function arcsin. The range of angles returned is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN or its absolute value is beyond 1, the result is NaN; and the arcsine of 0 retains its sign. This is accurate within 1 ulp, and is semi-monotonic.
 public static native double atan(double a)
    The trigonometric function arcsin. The range of angles returned is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN, the result is NaN; and the arctangent of 0 retains its sign. This is accurate within 1 ulp, and is semi-monotonic.
 public static native double atan2(double y,
    double x)
    A special version of the trigonometric function arctan, for converting rectangular coordinates (x, y) to polar (r, theta). This computes the arctangent of x/y in the range of -pi to pi radians (-180 to 180 degrees). Special cases:
    • If either argument is NaN, the result is NaN.
    • If the first argument is positive zero and the second argument is positive, or the first argument is positive and finite and the second argument is positive infinity, then the result is positive zero.
    • If the first argument is negative zero and the second argument is positive, or the first argument is negative and finite and the second argument is positive infinity, then the result is negative zero.
    • If the first argument is positive zero and the second argument is negative, or the first argument is positive and finite and the second argument is negative infinity, then the result is the double value closest to pi.
    • If the first argument is negative zero and the second argument is negative, or the first argument is negative and finite and the second argument is negative infinity, then the result is the double value closest to -pi.
    • If the first argument is positive and the second argument is positive zero or negative zero, or the first argument is positive infinity and the second argument is finite, then the result is the double value closest to pi/2.
    • If the first argument is negative and the second argument is positive zero or negative zero, or the first argument is negative infinity and the second argument is finite, then the result is the double value closest to -pi/2.
    • If both arguments are positive infinity, then the result is the double value closest to pi/4.
    • If the first argument is positive infinity and the second argument is negative infinity, then the result is the double value closest to 3*pi/4.
    • If the first argument is negative infinity and the second argument is positive infinity, then the result is the double value closest to -pi/4.
    • If both arguments are negative infinity, then the result is the double value closest to -3*pi/4.

    This is accurate within 2 ulps, and is semi-monotonic. To get r, use sqrt(x*x+y*y).

 public static native double cbrt(double a)

    Take a cube root. If the argument is NaN, an infinity or zero, then the original value is returned. The returned result must be within 1 ulp of the exact result. For a finite value, x, the cube root of -x is equal to the negation of the cube root of x.

    For a square root, use sqrt. For other roots, use pow(a, 1 / rootNumber).

 public static native double ceil(double a)
    Take the nearest integer that is that is greater than or equal to the argument. If the argument is NaN, infinite, or zero, the result is the same; if the argument is between -1 and 0, the result is negative zero. Note that Math.ceil(x) == -Math.floor(-x).
 public static native double cos(double a)
    The trigonometric function cos. The cosine of NaN or infinity is NaN. This is accurate within 1 ulp, and is semi-monotonic.
 public static native double cosh(double a)

    Returns the hyperbolic cosine of the given value. For a value, x, the hyperbolic cosine is (ex + e-x)/2 with e being Euler's number. The returned result must be within 2.5 ulps of the exact result.

    If the supplied value is NaN, then the original value is returned. For either infinity, positive infinity is returned. The hyperbolic cosine of zero must be 1.0.

 public static native double exp(double a)
    Take ea. The opposite of log(). If the argument is NaN, the result is NaN; if the argument is positive infinity, the result is positive infinity; and if the argument is negative infinity, the result is positive zero. This is accurate within 1 ulp, and is semi-monotonic.
 public static native double expm1(double a)

    Returns ea - 1. For values close to 0, the result of expm1(a) + 1 tend to be much closer to the exact result than simply exp(x). The result must be within 1 ulp of the exact result, and results must be semi-monotonic. For finite inputs, the returned value must be greater than or equal to -1.0. Once a result enters within half a ulp of this limit, the limit is returned.

    For NaN, positive infinity and zero, the original value is returned. Negative infinity returns a result of -1.0 (the limit).

 public static native double floor(double a)
    Take the nearest integer that is that is less than or equal to the argument. If the argument is NaN, infinite, or zero, the result is the same. Note that Math.ceil(x) == -Math.floor(-x).
 public static native double hypot(double a,
    double b)

    Returns the hypotenuse, a2 + b2, without intermediate overflow or underflow. The returned result must be within 1 ulp of the exact result. If one parameter is held constant, then the result in the other parameter must be semi-monotonic.

    If either of the arguments is an infinity, then the returned result is positive infinity. Otherwise, if either argument is NaN, then NaN is returned.

 public static native double log(double a)
    Take ln(a) (the natural log). The opposite of exp(). If the argument is NaN or negative, the result is NaN; if the argument is positive infinity, the result is positive infinity; and if the argument is either zero, the result is negative infinity. This is accurate within 1 ulp, and is semi-monotonic.

    Note that the way to get logb(a) is to do this: ln(a) / ln(b).

 public static native double log10(double a)

    Returns the base 10 logarithm of the supplied value. The returned result must within 1 ulp of the exact result, and the results must be semi-monotonic.

    Arguments of either NaN or less than zero return NaN. An argument of positive infinity returns positive infinity. Negative infinity is returned if either positive or negative zero is supplied. Where the argument is the result of 10n, then n is returned.

 public static native double log1p(double a)

    Returns the natural logarithm resulting from the sum of the argument, a and 1. For values close to 0, the result of log1p(a) tend to be much closer to the exact result than simply log(1.0+a). The returned result must be within 1 ulp of the exact result, and the results must be semi-monotonic.

    Arguments of either NaN or less than -1 return NaN. An argument of positive infinity or zero returns the original argument. Negative infinity is returned from an argument of -1.

 public static native double pow(double a,
    double b)
    Raise a number to a power. Special cases:
    • If the second argument is positive or negative zero, then the result is 1.0.
    • If the second argument is 1.0, then the result is the same as the first argument.
    • If the second argument is NaN, then the result is NaN.
    • If the first argument is NaN and the second argument is nonzero, then the result is NaN.
    • If the absolute value of the first argument is greater than 1 and the second argument is positive infinity, or the absolute value of the first argument is less than 1 and the second argument is negative infinity, then the result is positive infinity.
    • If the absolute value of the first argument is greater than 1 and the second argument is negative infinity, or the absolute value of the first argument is less than 1 and the second argument is positive infinity, then the result is positive zero.
    • If the absolute value of the first argument equals 1 and the second argument is infinite, then the result is NaN.
    • If the first argument is positive zero and the second argument is greater than zero, or the first argument is positive infinity and the second argument is less than zero, then the result is positive zero.
    • If the first argument is positive zero and the second argument is less than zero, or the first argument is positive infinity and the second argument is greater than zero, then the result is positive infinity.
    • If the first argument is negative zero and the second argument is greater than zero but not a finite odd integer, or the first argument is negative infinity and the second argument is less than zero but not a finite odd integer, then the result is positive zero.
    • If the first argument is negative zero and the second argument is a positive finite odd integer, or the first argument is negative infinity and the second argument is a negative finite odd integer, then the result is negative zero.
    • If the first argument is negative zero and the second argument is less than zero but not a finite odd integer, or the first argument is negative infinity and the second argument is greater than zero but not a finite odd integer, then the result is positive infinity.
    • If the first argument is negative zero and the second argument is a negative finite odd integer, or the first argument is negative infinity and the second argument is a positive finite odd integer, then the result is negative infinity.
    • If the first argument is less than zero and the second argument is a finite even integer, then the result is equal to the result of raising the absolute value of the first argument to the power of the second argument.
    • If the first argument is less than zero and the second argument is a finite odd integer, then the result is equal to the negative of the result of raising the absolute value of the first argument to the power of the second argument.
    • If the first argument is finite and less than zero and the second argument is finite and not an integer, then the result is NaN.
    • If both arguments are integers, then the result is exactly equal to the mathematical result of raising the first argument to the power of the second argument if that result can in fact be represented exactly as a double value.

    (In the foregoing descriptions, a floating-point value is considered to be an integer if and only if it is a fixed point of the method #ceil(double) or, equivalently, a fixed point of the method #floor(double) . A value is a fixed point of a one-argument method if and only if the result of applying the method to the value is equal to the value.) This is accurate within 1 ulp, and is semi-monotonic.

 public static native double rint(double a)
    Take the nearest integer to the argument. If it is exactly between two integers, the even integer is taken. If the argument is NaN, infinite, or zero, the result is the same.
 public static native double sin(double a)
    The trigonometric function sin. The sine of NaN or infinity is NaN, and the sine of 0 retains its sign. This is accurate within 1 ulp, and is semi-monotonic.
 public static native double sinh(double a)

    Returns the hyperbolic sine of the given value. For a value, x, the hyperbolic sine is (ex - e-x)/2 with e being Euler's number. The returned result must be within 2.5 ulps of the exact result.

    If the supplied value is NaN, an infinity or a zero, then the original value is returned.

 public static native double sqrt(double a)
    Take a square root. If the argument is NaN or negative, the result is NaN; if the argument is positive infinity, the result is positive infinity; and if the result is either zero, the result is the same. This is accurate within the limits of doubles.

    For other roots, use pow(a, 1 / rootNumber).

 public static native double tan(double a)
    The trigonometric function tan. The tangent of NaN or infinity is NaN, and the tangent of 0 retains its sign. This is accurate within 1 ulp, and is semi-monotonic.
 public static native double tanh(double a)

    Returns the hyperbolic tangent of the given value. For a value, x, the hyperbolic tangent is (ex - e-x)/(ex + e-x) (i.e. sinh(a)/cosh(a)) with e being Euler's number. The returned result must be within 2.5 ulps of the exact result. The absolute value of the exact result is always less than 1. Computed results are thus less than or equal to 1 for finite arguments, with results within half a ulp of either positive or negative 1 returning the appropriate limit value (i.e. as if the argument was an infinity).

    If the supplied value is NaN or zero, then the original value is returned. Positive infinity returns +1.0 and negative infinity returns -1.0.