java.lang.Object java.lang.MathThe class {@code Math} contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.
Unlike some of the numeric methods of class {@code StrictMath}, all implementations of the equivalent functions of class {@code Math} are not defined to return the bitforbit same results. This relaxation permits betterperforming implementations where strict reproducibility is not required.
By default many of the {@code Math} methods simply call the equivalent method in {@code StrictMath} for their implementation. Code generators are encouraged to use platformspecific native libraries or microprocessor instructions, where available, to provide higherperformance implementations of {@code Math} methods. Such higherperformance implementations still must conform to the specification for {@code Math}.
The quality of implementation specifications concern two properties, accuracy of the returned result and monotonicity of the method. Accuracy of the floatingpoint {@code Math} methods is measured in terms of ulps, units in the last place. For a given floatingpoint format, an ulp of a specific real number value is the distance between the two floatingpoint values bracketing that numerical value. When discussing the accuracy of a method as a whole rather than at a specific argument, the number of ulps cited is for the worstcase error at any argument. If a method always has an error less than 0.5 ulps, the method always returns the floatingpoint number nearest the exact result; such a method is correctly rounded. A correctly rounded method is generally the best a floatingpoint approximation can be; however, it is impractical for many floatingpoint methods to be correctly rounded. Instead, for the {@code Math} class, a larger error bound of 1 or 2 ulps is allowed for certain methods. Informally, with a 1 ulp error bound, when the exact result is a representable number, the exact result should be returned as the computed result; otherwise, either of the two floatingpoint values which bracket the exact result may be returned. For exact results large in magnitude, one of the endpoints of the bracket may be infinite. Besides accuracy at individual arguments, maintaining proper relations between the method at different arguments is also important. Therefore, most methods with more than 0.5 ulp errors are required to be semimonotonic: whenever the mathematical function is nondecreasing, so is the floatingpoint approximation, likewise, whenever the mathematical function is nonincreasing, so is the floatingpoint approximation. Not all approximations that have 1 ulp accuracy will automatically meet the monotonicity requirements.
unascribed
 Joseph
 D. DarcyJDK1.0
 Field Summary  

public static final double  E  The {@code double} value that is closer than any other to e, the base of the natural logarithms. 
public static final double  PI  The {@code double} value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter. 
Method from java.lang.Math Summary: 

IEEEremainder, abs, abs, abs, abs, acos, asin, atan, atan2, cbrt, ceil, copySign, copySign, cos, cosh, exp, expm1, floor, getExponent, getExponent, hypot, log, log10, log1p, max, max, max, max, min, min, min, min, nextAfter, nextAfter, nextUp, nextUp, pow, random, rint, round, round, scalb, scalb, signum, signum, sin, sinh, sqrt, tan, tanh, toDegrees, toRadians, ulp, ulp 
Methods from java.lang.Object: 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Method from java.lang.Math Detail: 

public static double IEEEremainder(double f1, double f2){ return StrictMath.IEEEremainder(f1, f2); // delegate to StrictMath }
f1  f2 × n,
where n is the mathematical integer closest to the exact
mathematical value of the quotient {@code f1/f2}, and if two
mathematical integers are equally close to {@code f1/f2},
then n is the integer that is even. If the remainder is
zero, its sign is the same as the sign of the first argument.
Special cases:

public static int abs(int a){ return (a < 0) ? a : a; }
Note that if the argument is equal to the value of Integer#MIN_VALUE , the most negative representable {@code int} value, the result is that same value, which is negative. 
public static long abs(long a){ return (a < 0) ? a : a; }
Note that if the argument is equal to the value of Long#MIN_VALUE , the most negative representable {@code long} value, the result is that same value, which is negative. 
public static float abs(float a){ return (a < = 0.0F) ? 0.0F  a : a; }
{@code Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))} 
public static double abs(double a){ return (a < = 0.0D) ? 0.0D  a : a; }
{@code Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)} 
public static double acos(double a){ return StrictMath.acos(a); // default impl. delegates to StrictMath }
The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double asin(double a){ return StrictMath.asin(a); // default impl. delegates to StrictMath }
The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double atan(double a){ return StrictMath.atan(a); // default impl. delegates to StrictMath }
The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double atan2(double y, double x){ return StrictMath.atan2(y, x); // default impl. delegates to StrictMath }
The computed result must be within 2 ulps of the exact result. Results must be semimonotonic. 
public static double cbrt(double a){ return StrictMath.cbrt(a); }
The computed result must be within 1 ulp of the exact result. 
public static double ceil(double a){ return StrictMath.ceil(a); // default impl. delegates to StrictMath }

public static double copySign(double magnitude, double sign){ return sun.misc.FpUtils.rawCopySign(magnitude, sign); }

public static float copySign(float magnitude, float sign){ return sun.misc.FpUtils.rawCopySign(magnitude, sign); }

public static double cos(double a){ return StrictMath.cos(a); // default impl. delegates to StrictMath }
The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double cosh(double x){ return StrictMath.cosh(x); }
Special cases: The computed result must be within 2.5 ulps of the exact result. 
public static double exp(double a){ return StrictMath.exp(a); // default impl. delegates to StrictMath }
The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double expm1(double x){ return StrictMath.expm1(x); }
Special cases: The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. The result of {@code expm1} for any finite input must be greater than or equal to {@code 1.0}. Note that once the exact result of e^{{@code x}}  1 is within 1/2 ulp of the limit value 1, {@code 1.0} should be returned. 
public static double floor(double a){ return StrictMath.floor(a); // default impl. delegates to StrictMath }

public static int getExponent(float f){ return sun.misc.FpUtils.getExponent(f); }

public static int getExponent(double d){ return sun.misc.FpUtils.getExponent(d); }

public static double hypot(double x, double y){ return StrictMath.hypot(x, y); }
Special cases: The computed result must be within 1 ulp of the exact result. If one parameter is held constant, the results must be semimonotonic in the other parameter. 
public static double log(double a){ return StrictMath.log(a); // default impl. delegates to StrictMath }
The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double log10(double a){ return StrictMath.log10(a); // default impl. delegates to StrictMath }
The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double log1p(double x){ return StrictMath.log1p(x); }
Special cases: The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static int max(int a, int b){ return (a >= b) ? a : b; }

public static long max(long a, long b){ return (a >= b) ? a : b; }

public static float max(float a, float b){ if (a != a) return a; // a is NaN if ((a == 0.0f) && (b == 0.0f) && (Float.floatToIntBits(a) == negativeZeroFloatBits)) { return b; } return (a >= b) ? a : b; }

public static double max(double a, double b){ if (a != a) return a; // a is NaN if ((a == 0.0d) && (b == 0.0d) && (Double.doubleToLongBits(a) == negativeZeroDoubleBits)) { return b; } return (a >= b) ? a : b; }

public static int min(int a, int b){ return (a < = b) ? a : b; }

public static long min(long a, long b){ return (a < = b) ? a : b; }

public static float min(float a, float b){ if (a != a) return a; // a is NaN if ((a == 0.0f) && (b == 0.0f) && (Float.floatToIntBits(b) == negativeZeroFloatBits)) { return b; } return (a < = b) ? a : b; }

public static double min(double a, double b){ if (a != a) return a; // a is NaN if ((a == 0.0d) && (b == 0.0d) && (Double.doubleToLongBits(b) == negativeZeroDoubleBits)) { return b; } return (a < = b) ? a : b; }

public static double nextAfter(double start, double direction){ return sun.misc.FpUtils.nextAfter(start, direction); }
Special cases: 
public static float nextAfter(float start, double direction){ return sun.misc.FpUtils.nextAfter(start, direction); }
Special cases: 
public static double nextUp(double d){ return sun.misc.FpUtils.nextUp(d); }
Special Cases: 
public static float nextUp(float f){ return sun.misc.FpUtils.nextUp(f); }
Special Cases: 
public static double pow(double a, double b){ return StrictMath.pow(a, b); // default impl. delegates to StrictMath }
(In the foregoing descriptions, a floatingpoint value is considered to be an integer if and only if it is finite and a fixed point of the method ceil or, equivalently, a fixed point of the method floor . A value is a fixed point of a oneargument method if and only if the result of applying the method to the value is equal to the value.) The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double random(){ Random rnd = randomNumberGenerator; if (rnd == null) rnd = initRNG(); return rnd.nextDouble(); }
When this method is first called, it creates a single new pseudorandomnumber generator, exactly as if by the expression {@code new java.util.Random()}This new pseudorandomnumber generator is used thereafter for all calls to this method and is used nowhere else. This method is properly synchronized to allow correct use by more than one thread. However, if many threads need to generate pseudorandom numbers at a great rate, it may reduce contention for each thread to have its own pseudorandomnumber generator. 
public static double rint(double a){ return StrictMath.rint(a); // default impl. delegates to StrictMath }

public static int round(float a){ if (a != 0x1.fffffep2f) // greatest float value less than 0.5 return (int)floor(a + 0.5f); else return 0; }
Special cases: 
public static long round(double a){ if (a != 0x1.fffffffffffffp2) // greatest double value less than 0.5 return (long)floor(a + 0.5d); else return 0; }
Special cases: 
public static double scalb(double d, int scaleFactor){ return sun.misc.FpUtils.scalb(d, scaleFactor); }
Special cases: 
public static float scalb(float f, int scaleFactor){ return sun.misc.FpUtils.scalb(f, scaleFactor); }
Special cases: 
public static double signum(double d){ return sun.misc.FpUtils.signum(d); }
Special Cases: 
public static float signum(float f){ return sun.misc.FpUtils.signum(f); }
Special Cases: 
public static double sin(double a){ return StrictMath.sin(a); // default impl. delegates to StrictMath }
The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double sinh(double x){ return StrictMath.sinh(x); }
Special cases: The computed result must be within 2.5 ulps of the exact result. 
public static double sqrt(double a){ return StrictMath.sqrt(a); // default impl. delegates to StrictMath // Note that hardware sqrt instructions // frequently can be directly used by JITs // and should be much faster than doing // Math.sqrt in software. }

public static double tan(double a){ return StrictMath.tan(a); // default impl. delegates to StrictMath }
The computed result must be within 1 ulp of the exact result. Results must be semimonotonic. 
public static double tanh(double x){ return StrictMath.tanh(x); }
Special cases: The computed result must be within 2.5 ulps of the exact result. The result of {@code tanh} for any finite input must have an absolute value less than or equal to 1. Note that once the exact result of tanh is within 1/2 of an ulp of the limit value of ±1, correctly signed ±{@code 1.0} should be returned. 
public static double toDegrees(double angrad){ return angrad * 180.0 / PI; }

public static double toRadians(double angdeg){ return angdeg / 180.0 * PI; }

public static double ulp(double d){ return sun.misc.FpUtils.ulp(d); }
ulp(x) == ulp(x) .
Special Cases: 
public static float ulp(float f){ return sun.misc.FpUtils.ulp(f); }
ulp(x) == ulp(x) .
Special Cases: 