Merge git+ssh://davetron5000@repo.or.cz/srv/git/vimdoclet
[vimdoclet.git] / sample / java.lang.Math.txt
blob43aea21b53f1addf98cb03557dbbe8de13508997
1 *java.lang.Math* *Math* The class Math contains methods for performing basic
2  nu
4 public final class Math
5   extends    |java.lang.Object|
7 |java.lang.Math_Description|
8 |java.lang.Math_Fields|
9 |java.lang.Math_Constructors|
10 |java.lang.Math_Methods|
12 ================================================================================
14 *java.lang.Math_Fields*
15 |double_java.lang.Math.E|
16 |double_java.lang.Math.PI|
18 *java.lang.Math_Methods*
19 |java.lang.Math.abs(double)|Returns the absolute value of a double value.
20 |java.lang.Math.abs(float)|Returns the absolute value of a float value.
21 |java.lang.Math.abs(int)|Returns the absolute value of an int value.
22 |java.lang.Math.abs(long)|Returns the absolute value of a long value.
23 |java.lang.Math.acos(double)|Returns the arc cosine of an angle, in the range o
24 |java.lang.Math.asin(double)|Returns the arc sine of an angle, in the range of 
25 |java.lang.Math.atan(double)|Returns the arc tangent of an angle, in the range 
26 |java.lang.Math.atan2(double,double)|Converts rectangular coordinates (x,y)  to
27 |java.lang.Math.cbrt(double)|Returns the cube root of a double value.
28 |java.lang.Math.ceil(double)|Returns the smallest (closest to negative infinity
29 |java.lang.Math.cos(double)|Returns the trigonometric cosine of an angle.
30 |java.lang.Math.cosh(double)|Returns the hyperbolic cosine of a double value.
31 |java.lang.Math.exp(double)|Returns Euler's number e raised to the power of a  
32 |java.lang.Math.expm1(double)|Returns ex-1.
33 |java.lang.Math.floor(double)|Returns the largest (closest to positive infinity
34 |java.lang.Math.hypot(double,double)|Returns sqrt(x2+y2)  without intermediate 
35 |java.lang.Math.IEEEremainder(double,double)|Computes the remainder operation o
36 |java.lang.Math.log(double)|Returns the natural logarithm (base e) of a double 
37 |java.lang.Math.log10(double)|Returns the base 10 logarithm of a double value.
38 |java.lang.Math.log1p(double)|Returns the natural logarithm of the sum of the a
39 |java.lang.Math.max(double,double)|Returns the greater of two double values.
40 |java.lang.Math.max(float,float)|Returns the greater of two float values.
41 |java.lang.Math.max(int,int)|Returns the greater of two int values.
42 |java.lang.Math.max(long,long)|Returns the greater of two long values.
43 |java.lang.Math.min(double,double)|Returns the smaller of two double values.
44 |java.lang.Math.min(float,float)|Returns the smaller of two float values.
45 |java.lang.Math.min(int,int)|Returns the smaller of two int values.
46 |java.lang.Math.min(long,long)|Returns the smaller of two long values.
47 |java.lang.Math.pow(double,double)|Returns the value of the first argument rais
48 |java.lang.Math.random()|Returns a double value with a positive sign, greater  
49 |java.lang.Math.rint(double)|Returns the double value that is closest in value 
50 |java.lang.Math.round(double)|Returns the closest long to the argument.
51 |java.lang.Math.round(float)|Returns the closest int to the argument.
52 |java.lang.Math.signum(double)|Returns the signum function of the argument; zer
53 |java.lang.Math.signum(float)|Returns the signum function of the argument; zero
54 |java.lang.Math.sin(double)|Returns the trigonometric sine of an angle.
55 |java.lang.Math.sinh(double)|Returns the hyperbolic sine of a double value.
56 |java.lang.Math.sqrt(double)|Returns the correctly rounded positive square root
57 |java.lang.Math.tan(double)|Returns the trigonometric tangent of an angle.
58 |java.lang.Math.tanh(double)|Returns the hyperbolic tangent of a double value.
59 |java.lang.Math.toDegrees(double)|Converts an angle measured in radians to an a
60 |java.lang.Math.toRadians(double)|Converts an angle measured in degrees to an a
61 |java.lang.Math.ulp(double)|Returns the size of an ulp of the argument.
62 |java.lang.Math.ulp(float)|Returns the size of an ulp of the argument.
64 *java.lang.Math_Description*
66 The class Math contains methods for performing basic numeric operations such as 
67 the elementary exponential, logarithm, square root, and trigonometric 
68 functions. 
70 Unlike some of the numeric methods of class StrictMath, all implementations of 
71 the equivalent functions of class Math are not defined to return the 
72 bit-for-bit same results. This relaxation permits better-performing 
73 implementations where strict reproducibility is not required. 
75 By default many of the Math methods simply call the equivalent method in 
76 StrictMath for their implementation. Code generators are encouraged to use 
77 platform-specific native libraries or microprocessor instructions, where 
78 available, to provide higher-performance implementations of Math methods. Such 
79 higher-performance implementations still must conform to the specification for 
80 Math. 
82 The quality of implementation specifications concern two properties, accuracy 
83 of the returned result and monotonicity of the method. Accuracy of the 
84 floating-point Math methods is measured in terms of ulps, units in the last 
85 place. For a given floating-point format, an ulp of a specific real number 
86 value is the distance between the two floating-point values bracketing that 
87 numerical value. When discussing the accuracy of a method as a whole rather 
88 than at a specific argument, the number of ulps cited is for the worst-case 
89 error at any argument. If a method always has an error less than 0.5 ulps, the 
90 method always returns the floating-point number nearest the exact result; such 
91 a method is correctly rounded. A correctly rounded method is generally the best 
92 a floating-point approximation can be; however, it is impractical for many 
93 floating-point methods to be correctly rounded. Instead, for the Math class, a 
94 larger error bound of 1 or 2 ulps is allowed for certain methods. Informally, 
95 with a 1 ulp error bound, when the exact result is a representable number, the 
96 exact result should be returned as the computed result; otherwise, either of 
97 the two floating-point values which bracket the exact result may be returned. 
98 For exact results large in magnitude, one of the endpoints of the bracket may 
99 be infinite. Besides accuracy at individual arguments, maintaining proper 
100 relations between the method at different arguments is also important. 
101 Therefore, most methods with more than 0.5 ulp errors are required to be 
102 semi-monotonic: whenever the mathematical function is non-decreasing, so is the 
103 floating-point approximation, likewise, whenever the mathematical function is 
104 non-increasing, so is the floating-point approximation. Not all approximations 
105 that have 1 ulp accuracy will automatically meet the monotonicity requirements. 
108 *double_java.lang.Math.E*
110 The class Math contains methods for performing basic numeric operations such as 
111 the elementary exponential, logarithm, square root, and trigonometric 
112 functions. 
114 Unlike some of the numeric methods of class StrictMath, all implementations of 
115 the equivalent functions of class Math are not defined to return the 
116 bit-for-bit same results. This relaxation permits better-performing 
117 implementations where strict reproducibility is not required. 
119 By default many of the Math methods simply call the equivalent method in 
120 StrictMath for their implementation. Code generators are encouraged to use 
121 platform-specific native libraries or microprocessor instructions, where 
122 available, to provide higher-performance implementations of Math methods. Such 
123 higher-performance implementations still must conform to the specification for 
124 Math. 
126 The quality of implementation specifications concern two properties, accuracy 
127 of the returned result and monotonicity of the method. Accuracy of the 
128 floating-point Math methods is measured in terms of ulps, units in the last 
129 place. For a given floating-point format, an ulp of a specific real number 
130 value is the distance between the two floating-point values bracketing that 
131 numerical value. When discussing the accuracy of a method as a whole rather 
132 than at a specific argument, the number of ulps cited is for the worst-case 
133 error at any argument. If a method always has an error less than 0.5 ulps, the 
134 method always returns the floating-point number nearest the exact result; such 
135 a method is correctly rounded. A correctly rounded method is generally the best 
136 a floating-point approximation can be; however, it is impractical for many 
137 floating-point methods to be correctly rounded. Instead, for the Math class, a 
138 larger error bound of 1 or 2 ulps is allowed for certain methods. Informally, 
139 with a 1 ulp error bound, when the exact result is a representable number, the 
140 exact result should be returned as the computed result; otherwise, either of 
141 the two floating-point values which bracket the exact result may be returned. 
142 For exact results large in magnitude, one of the endpoints of the bracket may 
143 be infinite. Besides accuracy at individual arguments, maintaining proper 
144 relations between the method at different arguments is also important. 
145 Therefore, most methods with more than 0.5 ulp errors are required to be 
146 semi-monotonic: whenever the mathematical function is non-decreasing, so is the 
147 floating-point approximation, likewise, whenever the mathematical function is 
148 non-increasing, so is the floating-point approximation. Not all approximations 
149 that have 1 ulp accuracy will automatically meet the monotonicity requirements. 
152 *double_java.lang.Math.PI*
154 The class Math contains methods for performing basic numeric operations such as 
155 the elementary exponential, logarithm, square root, and trigonometric 
156 functions. 
158 Unlike some of the numeric methods of class StrictMath, all implementations of 
159 the equivalent functions of class Math are not defined to return the 
160 bit-for-bit same results. This relaxation permits better-performing 
161 implementations where strict reproducibility is not required. 
163 By default many of the Math methods simply call the equivalent method in 
164 StrictMath for their implementation. Code generators are encouraged to use 
165 platform-specific native libraries or microprocessor instructions, where 
166 available, to provide higher-performance implementations of Math methods. Such 
167 higher-performance implementations still must conform to the specification for 
168 Math. 
170 The quality of implementation specifications concern two properties, accuracy 
171 of the returned result and monotonicity of the method. Accuracy of the 
172 floating-point Math methods is measured in terms of ulps, units in the last 
173 place. For a given floating-point format, an ulp of a specific real number 
174 value is the distance between the two floating-point values bracketing that 
175 numerical value. When discussing the accuracy of a method as a whole rather 
176 than at a specific argument, the number of ulps cited is for the worst-case 
177 error at any argument. If a method always has an error less than 0.5 ulps, the 
178 method always returns the floating-point number nearest the exact result; such 
179 a method is correctly rounded. A correctly rounded method is generally the best 
180 a floating-point approximation can be; however, it is impractical for many 
181 floating-point methods to be correctly rounded. Instead, for the Math class, a 
182 larger error bound of 1 or 2 ulps is allowed for certain methods. Informally, 
183 with a 1 ulp error bound, when the exact result is a representable number, the 
184 exact result should be returned as the computed result; otherwise, either of 
185 the two floating-point values which bracket the exact result may be returned. 
186 For exact results large in magnitude, one of the endpoints of the bracket may 
187 be infinite. Besides accuracy at individual arguments, maintaining proper 
188 relations between the method at different arguments is also important. 
189 Therefore, most methods with more than 0.5 ulp errors are required to be 
190 semi-monotonic: whenever the mathematical function is non-decreasing, so is the 
191 floating-point approximation, likewise, whenever the mathematical function is 
192 non-increasing, so is the floating-point approximation. Not all approximations 
193 that have 1 ulp accuracy will automatically meet the monotonicity requirements. 
197 *java.lang.Math.abs(double)*
199 public static double abs(double a)
201 Returns the absolute value of a double value. If the argument is not negative, 
202 the argument is returned. If the argument is negative, the negation of the 
203 argument is returned. Special cases: If the argument is positive zero or 
204 negative zero, the result is positive zero. If the argument is infinite, the 
205 result is positive infinity. If the argument is NaN, the result is NaN. In 
206 other words, the result is the same as the value of the expression: 
207 Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1) 
209     a - the argument whose absolute value is to be determined 
211     Returns: the absolute value of the argument. 
212 *java.lang.Math.abs(float)*
214 public static float abs(float a)
216 Returns the absolute value of a float value. If the argument is not negative, 
217 the argument is returned. If the argument is negative, the negation of the 
218 argument is returned. Special cases: If the argument is positive zero or 
219 negative zero, the result is positive zero. If the argument is infinite, the 
220 result is positive infinity. If the argument is NaN, the result is NaN. In 
221 other words, the result is the same as the value of the expression: 
223 Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a)) 
225     a - the argument whose absolute value is to be determined 
227     Returns: the absolute value of the argument. 
228 *java.lang.Math.abs(int)*
230 public static int abs(int a)
232 Returns the absolute value of an int value. If the argument is not negative, 
233 the argument is returned. If the argument is negative, the negation of the 
234 argument is returned. 
236 Note that if the argument is equal to the value of Integer.MIN_VALUE, the most 
237 negative representable int value, the result is that same value, which is 
238 negative. 
240     a - the argument whose absolute value is to be determined 
242     Returns: the absolute value of the argument. 
243 *java.lang.Math.abs(long)*
245 public static long abs(long a)
247 Returns the absolute value of a long value. If the argument is not negative, 
248 the argument is returned. If the argument is negative, the negation of the 
249 argument is returned. 
251 Note that if the argument is equal to the value of Long.MIN_VALUE, the most 
252 negative representable long value, the result is that same value, which is 
253 negative. 
255     a - the argument whose absolute value is to be determined 
257     Returns: the absolute value of the argument. 
258 *java.lang.Math.acos(double)*
260 public static double acos(double a)
262 Returns the arc cosine of an angle, in the range of 0.0 through pi. Special 
263 case: If the argument is NaN or its absolute value is greater than 1, then the 
264 result is NaN. 
266 The computed result must be within 1 ulp of the exact result. Results must be 
267 semi-monotonic. 
269     a - the value whose arc cosine is to be returned. 
271     Returns: the arc cosine of the argument. 
272 *java.lang.Math.asin(double)*
274 public static double asin(double a)
276 Returns the arc sine of an angle, in the range of -pi/2 through pi/2. Special 
277 cases: If the argument is NaN or its absolute value is greater than 1, then the 
278 result is NaN. If the argument is zero, then the result is a zero with the same 
279 sign as the argument. 
281 The computed result must be within 1 ulp of the exact result. Results must be 
282 semi-monotonic. 
284     a - the value whose arc sine is to be returned. 
286     Returns: the arc sine of the argument. 
287 *java.lang.Math.atan(double)*
289 public static double atan(double a)
291 Returns the arc tangent of an angle, in the range of -pi/2 through pi/2. 
292 Special cases: If the argument is NaN, then the result is NaN. If the argument 
293 is zero, then the result is a zero with the same sign as the argument. 
295 The computed result must be within 1 ulp of the exact result. Results must be 
296 semi-monotonic. 
298     a - the value whose arc tangent is to be returned. 
300     Returns: the arc tangent of the argument. 
301 *java.lang.Math.atan2(double,double)*
303 public static double atan2(
304   double y,
305   double x)
307 Converts rectangular coordinates (x,y) to polar (r,theta). This method computes 
308 the phase theta by computing an arc tangent of y/x in the range of -pi to pi. 
309 Special cases: If either argument is NaN, then the result is NaN. If the first 
310 argument is positive zero and the second argument is positive, or the first 
311 argument is positive and finite and the second argument is positive infinity, 
312 then the result is positive zero. If the first argument is negative zero and 
313 the second argument is positive, or the first argument is negative and finite 
314 and the second argument is positive infinity, then the result is negative zero. 
315 If the first argument is positive zero and the second argument is negative, or 
316 the first argument is positive and finite and the second argument is negative 
317 infinity, then the result is the double value closest to pi. If the first 
318 argument is negative zero and the second argument is negative, or the first 
319 argument is negative and finite and the second argument is negative infinity, 
320 then the result is the double value closest to -pi. If the first argument is 
321 positive and the second argument is positive zero or negative zero, or the 
322 first argument is positive infinity and the second argument is finite, then the 
323 result is the double value closest to pi/2. If the first argument is negative 
324 and the second argument is positive zero or negative zero, or the first 
325 argument is negative infinity and the second argument is finite, then the 
326 result is the double value closest to -pi/2. If both arguments are positive 
327 infinity, then the result is the double value closest to pi/4. If the first 
328 argument is positive infinity and the second argument is negative infinity, 
329 then the result is the double value closest to 3*pi/4. If the first argument is 
330 negative infinity and the second argument is positive infinity, then the result 
331 is the double value closest to -pi/4. If both arguments are negative infinity, 
332 then the result is the double value closest to -3*pi/4. 
334 The computed result must be within 2 ulps of the exact result. Results must be 
335 semi-monotonic. 
337     y - the ordinate coordinate 
338     x - the abscissa coordinate 
340     Returns: the theta component of the point (r,theta) in polar coordinates that 
341              corresponds to the point (x,y) in Cartesian coordinates. 
342 *java.lang.Math.cbrt(double)*
344 public static double cbrt(double a)
346 Returns the cube root of a double value. For positive finite x, cbrt(-x) == 
347 -cbrt(x); that is, the cube root of a negative value is the negative of the 
348 cube root of that value's magnitude. 
350 Special cases: 
354 If the argument is NaN, then the result is NaN. 
356 If the argument is infinite, then the result is an infinity with the same sign 
357 as the argument. 
359 If the argument is zero, then the result is a zero with the same sign as the 
360 argument. 
364 The computed result must be within 1 ulp of the exact result. 
366     a - a value. 
368     Returns: the cube root of a. 
369 *java.lang.Math.ceil(double)*
371 public static double ceil(double a)
373 Returns the smallest (closest to negative infinity) double value that is 
374 greater than or equal to the argument and is equal to a mathematical integer. 
375 Special cases: If the argument value is already equal to a mathematical 
376 integer, then the result is the same as the argument. If the argument is NaN or 
377 an infinity or positive zero or negative zero, then the result is the same as 
378 the argument. If the argument value is less than zero but greater than -1.0, 
379 then the result is negative zero. Note that the value of Math.ceil(x) is 
380 exactly the value of -Math.floor(-x). 
382     a - a value. 
384     Returns: the smallest (closest to negative infinity) floating-point value that is 
385              greater than or equal to the argument and is equal to a 
386              mathematical integer. 
387 *java.lang.Math.cos(double)*
389 public static double cos(double a)
391 Returns the trigonometric cosine of an angle. Special cases: If the argument is 
392 NaN or an infinity, then the result is NaN. 
394 The computed result must be within 1 ulp of the exact result. Results must be 
395 semi-monotonic. 
397     a - an angle, in radians. 
399     Returns: the cosine of the argument. 
400 *java.lang.Math.cosh(double)*
402 public static double cosh(double x)
404 Returns the hyperbolic cosine of a double value. The hyperbolic cosine of x is 
405 defined to be (ex+e-x)/2 where e is Euler's number(|java.lang.Math|) . 
407 Special cases: 
409 If the argument is NaN, then the result is NaN. 
411 If the argument is infinite, then the result is positive infinity. 
413 If the argument is zero, then the result is 1.0. 
417 The computed result must be within 2.5 ulps of the exact result. 
419     x - The number whose hyperbolic cosine is to be returned. 
421     Returns: The hyperbolic cosine of x. 
422 *java.lang.Math.exp(double)*
424 public static double exp(double a)
426 Returns Euler's number e raised to the power of a double value. Special cases: 
427 If the argument is NaN, the result is NaN. If the argument is positive 
428 infinity, then the result is positive infinity. If the argument is negative 
429 infinity, then the result is positive zero. 
431 The computed result must be within 1 ulp of the exact result. Results must be 
432 semi-monotonic. 
434     a - the exponent to raise e to. 
436     Returns: the value ea, where e is the base of the natural logarithms. 
437 *java.lang.Math.expm1(double)*
439 public static double expm1(double x)
441 Returns ex-1. Note that for values of x near 0, the exact sum of expm1(x)+1 is 
442 much closer to the true result of ex than exp(x). 
444 Special cases: 
446 If the argument is NaN, the result is NaN. 
448 If the argument is positive infinity, then the result is positive infinity. 
450 If the argument is negative infinity, then the result is -1.0. 
452 If the argument is zero, then the result is a zero with the same sign as the 
453 argument. 
457 The computed result must be within 1 ulp of the exact result. Results must be 
458 semi-monotonic. The result of expm1 for any finite input must be greater than 
459 or equal to -1.0. Note that once the exact result of ex-1 is within 1/2 ulp of 
460 the limit value -1, -1.0 should be returned. 
462     x - the exponent to raise e to in the computation of ex-1. 
464     Returns: the value ex-1. 
465 *java.lang.Math.floor(double)*
467 public static double floor(double a)
469 Returns the largest (closest to positive infinity) double value that is less 
470 than or equal to the argument and is equal to a mathematical integer. Special 
471 cases: If the argument value is already equal to a mathematical integer, then 
472 the result is the same as the argument. If the argument is NaN or an infinity 
473 or positive zero or negative zero, then the result is the same as the argument. 
475     a - a value. 
477     Returns: the largest (closest to positive infinity) floating-point value that less than 
478              or equal to the argument and is equal to a mathematical integer. 
479 *java.lang.Math.hypot(double,double)*
481 public static double hypot(
482   double x,
483   double y)
485 Returns sqrt(x2+y2) without intermediate overflow or underflow. 
487 Special cases: 
489 If either argument is infinite, then the result is positive infinity. 
491 If either argument is NaN and neither argument is infinite, then the result is 
492 NaN. 
496 The computed result must be within 1 ulp of the exact result. If one parameter 
497 is held constant, the results must be semi-monotonic in the other parameter. 
499     x - a value 
500     y - a value 
502     Returns: sqrt(x2+y2) without intermediate overflow or underflow 
503 *java.lang.Math.IEEEremainder(double,double)*
505 public static double IEEEremainder(
506   double f1,
507   double f2)
509 Computes the remainder operation on two arguments as prescribed by the IEEE 754 
510 standard. The remainder value is mathematically equal to f1-f2n, where n is the 
511 mathematical integer closest to the exact mathematical value of the quotient 
512 f1/f2, and if two mathematical integers are equally close to f1/f2, then n is 
513 the integer that is even. If the remainder is zero, its sign is the same as the 
514 sign of the first argument. Special cases: If either argument is NaN, or the 
515 first argument is infinite, or the second argument is positive zero or negative 
516 zero, then the result is NaN. If the first argument is finite and the second 
517 argument is infinite, then the result is the same as the first argument. 
519     f1 - the dividend. 
520     f2 - the divisor. 
522     Returns: the remainder when f1 is divided by f2. 
523 *java.lang.Math.log(double)*
525 public static double log(double a)
527 Returns the natural logarithm (base e) of a double value. Special cases: If the 
528 argument is NaN or less than zero, then the result is NaN. If the argument is 
529 positive infinity, then the result is positive infinity. If the argument is 
530 positive zero or negative zero, then the result is negative infinity. 
532 The computed result must be within 1 ulp of the exact result. Results must be 
533 semi-monotonic. 
535     a - a value 
537     Returns: the value lna, the natural logarithm of a. 
538 *java.lang.Math.log10(double)*
540 public static double log10(double a)
542 Returns the base 10 logarithm of a double value. Special cases: 
544 If the argument is NaN or less than zero, then the result is NaN. If the 
545 argument is positive infinity, then the result is positive infinity. If the 
546 argument is positive zero or negative zero, then the result is negative 
547 infinity. If the argument is equal to 10n for integer n, then the result is n. 
549 The computed result must be within 1 ulp of the exact result. Results must be 
550 semi-monotonic. 
552     a - a value 
554     Returns: the base 10 logarithm of a. 
555 *java.lang.Math.log1p(double)*
557 public static double log1p(double x)
559 Returns the natural logarithm of the sum of the argument and 1. Note that for 
560 small values x, the result of log1p(x) is much closer to the true result of 
561 ln(1 + x) than the floating-point evaluation of log(1.0+x). 
563 Special cases: 
567 If the argument is NaN or less than -1, then the result is NaN. 
569 If the argument is positive infinity, then the result is positive infinity. 
571 If the argument is negative one, then the result is negative infinity. 
573 If the argument is zero, then the result is a zero with the same sign as the 
574 argument. 
578 The computed result must be within 1 ulp of the exact result. Results must be 
579 semi-monotonic. 
581     x - a value 
583     Returns: the value ln(x+1), the natural log of x+1 
584 *java.lang.Math.max(double,double)*
586 public static double max(
587   double a,
588   double b)
590 Returns the greater of two double values. That is, the result is the argument 
591 closer to positive infinity. If the arguments have the same value, the result 
592 is that same value. If either value is NaN, then the result is NaN. Unlike the 
593 numerical comparison operators, this method considers negative zero to be 
594 strictly smaller than positive zero. If one argument is positive zero and the 
595 other negative zero, the result is positive zero. 
597     a - an argument. 
598     b - another argument. 
600     Returns: the larger of a and b. 
601 *java.lang.Math.max(float,float)*
603 public static float max(
604   float a,
605   float b)
607 Returns the greater of two float values. That is, the result is the argument 
608 closer to positive infinity. If the arguments have the same value, the result 
609 is that same value. If either value is NaN, then the result is NaN. Unlike the 
610 numerical comparison operators, this method considers negative zero to be 
611 strictly smaller than positive zero. If one argument is positive zero and the 
612 other negative zero, the result is positive zero. 
614     a - an argument. 
615     b - another argument. 
617     Returns: the larger of a and b. 
618 *java.lang.Math.max(int,int)*
620 public static int max(
621   int a,
622   int b)
624 Returns the greater of two int values. That is, the result is the argument 
625 closer to the value of Integer.MAX_VALUE. If the arguments have the same value, 
626 the result is that same value. 
628     a - an argument. 
629     b - another argument. 
631     Returns: the larger of a and b. 
632 *java.lang.Math.max(long,long)*
634 public static long max(
635   long a,
636   long b)
638 Returns the greater of two long values. That is, the result is the argument 
639 closer to the value of Long.MAX_VALUE. If the arguments have the same value, 
640 the result is that same value. 
642     a - an argument. 
643     b - another argument. 
645     Returns: the larger of a and b. 
646 *java.lang.Math.min(double,double)*
648 public static double min(
649   double a,
650   double b)
652 Returns the smaller of two double values. That is, the result is the value 
653 closer to negative infinity. If the arguments have the same value, the result 
654 is that same value. If either value is NaN, then the result is NaN. Unlike the 
655 numerical comparison operators, this method considers negative zero to be 
656 strictly smaller than positive zero. If one argument is positive zero and the 
657 other is negative zero, the result is negative zero. 
659     a - an argument. 
660     b - another argument. 
662     Returns: the smaller of a and b. 
663 *java.lang.Math.min(float,float)*
665 public static float min(
666   float a,
667   float b)
669 Returns the smaller of two float values. That is, the result is the value 
670 closer to negative infinity. If the arguments have the same value, the result 
671 is that same value. If either value is NaN, then the result is NaN. Unlike the 
672 numerical comparison operators, this method considers negative zero to be 
673 strictly smaller than positive zero. If one argument is positive zero and the 
674 other is negative zero, the result is negative zero. 
676     a - an argument. 
677     b - another argument. 
679     Returns: the smaller of a and b. 
680 *java.lang.Math.min(int,int)*
682 public static int min(
683   int a,
684   int b)
686 Returns the smaller of two int values. That is, the result the argument closer 
687 to the value of Integer.MIN_VALUE. If the arguments have the same value, the 
688 result is that same value. 
690     a - an argument. 
691     b - another argument. 
693     Returns: the smaller of a and b. 
694 *java.lang.Math.min(long,long)*
696 public static long min(
697   long a,
698   long b)
700 Returns the smaller of two long values. That is, the result is the argument 
701 closer to the value of Long.MIN_VALUE. If the arguments have the same value, 
702 the result is that same value. 
704     a - an argument. 
705     b - another argument. 
707     Returns: the smaller of a and b. 
708 *java.lang.Math.pow(double,double)*
710 public static double pow(
711   double a,
712   double b)
714 Returns the value of the first argument raised to the power of the second 
715 argument. Special cases: 
717 If the second argument is positive or negative zero, then the result is 1.0. If 
718 the second argument is 1.0, then the result is the same as the first argument. 
719 If the second argument is NaN, then the result is NaN. If the first argument is 
720 NaN and the second argument is nonzero, then the result is NaN. 
722 If 
724 the absolute value of the first argument is greater than 1 and the second 
725 argument is positive infinity, or the absolute value of the first argument is 
726 less than 1 and the second argument is negative infinity, 
728 then the result is positive infinity. 
730 If 
732 the absolute value of the first argument is greater than 1 and the second 
733 argument is negative infinity, or the absolute value of the first argument is 
734 less than 1 and the second argument is positive infinity, 
736 then the result is positive zero. 
738 If the absolute value of the first argument equals 1 and the second argument is 
739 infinite, then the result is NaN. 
741 If 
743 the first argument is positive zero and the second argument is greater than 
744 zero, or the first argument is positive infinity and the second argument is 
745 less than zero, 
747 then the result is positive zero. 
749 If 
751 the first argument is positive zero and the second argument is less than zero, 
752 or the first argument is positive infinity and the second argument is greater 
753 than zero, 
755 then the result is positive infinity. 
757 If 
759 the first argument is negative zero and the second argument is greater than 
760 zero but not a finite odd integer, or the first argument is negative infinity 
761 and the second argument is less than zero but not a finite odd integer, 
763 then the result is positive zero. 
765 If 
767 the first argument is negative zero and the second argument is a positive 
768 finite odd integer, or the first argument is negative infinity and the second 
769 argument is a negative finite odd integer, 
771 then the result is negative zero. 
773 If 
775 the first argument is negative zero and the second argument is less than zero 
776 but not a finite odd integer, or the first argument is negative infinity and 
777 the second argument is greater than zero but not a finite odd integer, 
779 then the result is positive infinity. 
781 If 
783 the first argument is negative zero and the second argument is a negative 
784 finite odd integer, or the first argument is negative infinity and the second 
785 argument is a positive finite odd integer, 
787 then the result is negative infinity. 
789 If the first argument is finite and less than zero 
791 if the second argument is a finite even integer, the result is equal to the 
792 result of raising the absolute value of the first argument to the power of the 
793 second argument 
795 if the second argument is a finite odd integer, the result is equal to the 
796 negative of the result of raising the absolute value of the first argument to 
797 the power of the second argument 
799 if the second argument is finite and not an integer, then the result is NaN. 
801 If both arguments are integers, then the result is exactly equal to the 
802 mathematical result of raising the first argument to the power of the second 
803 argument if that result can in fact be represented exactly as a double value. 
805 (In the foregoing descriptions, a floating-point value is considered to be an 
806 integer if and only if it is finite and a fixed point of the method 
807 <tt>ceil</tt>(|java.lang.Math|) or, equivalently, a fixed point of the method 
808 <tt>floor</tt>(|java.lang.Math|) . A value is a fixed point of a one-argument 
809 method if and only if the result of applying the method to the value is equal 
810 to the value.) 
812 The computed result must be within 1 ulp of the exact result. Results must be 
813 semi-monotonic. 
815     a - the base. 
816     b - the exponent. 
818     Returns: the value ab. 
819 *java.lang.Math.random()*
821 public static double random()
823 Returns a double value with a positive sign, greater than or equal to 0.0 and 
824 less than 1.0. Returned values are chosen pseudorandomly with (approximately) 
825 uniform distribution from that range. 
827 When this method is first called, it creates a single new pseudorandom-number 
828 generator, exactly as if by the expression 
830 new java.util.Random This new pseudorandom-number generator is used thereafter 
831 for all calls to this method and is used nowhere else. 
833 This method is properly synchronized to allow correct use by more than one 
834 thread. However, if many threads need to generate pseudorandom numbers at a 
835 great rate, it may reduce contention for each thread to have its own 
836 pseudorandom-number generator. 
839     Returns: a pseudorandom double greater than or equal to 0.0 and less than 1.0. 
840 *java.lang.Math.rint(double)*
842 public static double rint(double a)
844 Returns the double value that is closest in value to the argument and is equal 
845 to a mathematical integer. If two double values that are mathematical integers 
846 are equally close, the result is the integer value that is even. Special cases: 
847 If the argument value is already equal to a mathematical integer, then the 
848 result is the same as the argument. If the argument is NaN or an infinity or 
849 positive zero or negative zero, then the result is the same as the argument. 
851     a - a double value. 
853     Returns: the closest floating-point value to a that is equal to a mathematical integer. 
854 *java.lang.Math.round(double)*
856 public static long round(double a)
858 Returns the closest long to the argument. The result is rounded to an integer 
859 by adding 1/2, taking the floor of the result, and casting the result to type 
860 long. In other words, the result is equal to the value of the expression: 
862 (long)Math.floor(a + 0.5d) 
864 Special cases: If the argument is NaN, the result is 0. If the argument is 
865 negative infinity or any value less than or equal to the value of 
866 Long.MIN_VALUE, the result is equal to the value of Long.MIN_VALUE. If the 
867 argument is positive infinity or any value greater than or equal to the value 
868 of Long.MAX_VALUE, the result is equal to the value of Long.MAX_VALUE. 
870     a - a floating-point value to be rounded to a long. 
872     Returns: the value of the argument rounded to the nearest long value. 
873 *java.lang.Math.round(float)*
875 public static int round(float a)
877 Returns the closest int to the argument. The result is rounded to an integer by 
878 adding 1/2, taking the floor of the result, and casting the result to type int. 
879 In other words, the result is equal to the value of the expression: 
881 (int)Math.floor(a + 0.5f) 
883 Special cases: If the argument is NaN, the result is 0. If the argument is 
884 negative infinity or any value less than or equal to the value of 
885 Integer.MIN_VALUE, the result is equal to the value of Integer.MIN_VALUE. If 
886 the argument is positive infinity or any value greater than or equal to the 
887 value of Integer.MAX_VALUE, the result is equal to the value of 
888 Integer.MAX_VALUE. 
890     a - a floating-point value to be rounded to an integer. 
892     Returns: the value of the argument rounded to the nearest int value. 
893 *java.lang.Math.signum(double)*
895 public static double signum(double d)
897 Returns the signum function of the argument; zero if the argument is zero, 1.0 
898 if the argument is greater than zero, -1.0 if the argument is less than zero. 
900 Special Cases: 
902 If the argument is NaN, then the result is NaN. If the argument is positive 
903 zero or negative zero, then the result is the same as the argument. 
905     d - the floating-point value whose signum is to be returned 
907     Returns: the signum function of the argument 
908 *java.lang.Math.signum(float)*
910 public static float signum(float f)
912 Returns the signum function of the argument; zero if the argument is zero, 1.0f 
913 if the argument is greater than zero, -1.0f if the argument is less than zero. 
915 Special Cases: 
917 If the argument is NaN, then the result is NaN. If the argument is positive 
918 zero or negative zero, then the result is the same as the argument. 
920     f - the floating-point value whose signum is to be returned 
922     Returns: the signum function of the argument 
923 *java.lang.Math.sin(double)*
925 public static double sin(double a)
927 Returns the trigonometric sine of an angle. Special cases: If the argument is 
928 NaN or an infinity, then the result is NaN. If the argument is zero, then the 
929 result is a zero with the same sign as the argument. 
931 The computed result must be within 1 ulp of the exact result. Results must be 
932 semi-monotonic. 
934     a - an angle, in radians. 
936     Returns: the sine of the argument. 
937 *java.lang.Math.sinh(double)*
939 public static double sinh(double x)
941 Returns the hyperbolic sine of a double value. The hyperbolic sine of x is 
942 defined to be (ex-e-x)/2 where e is Euler's number(|java.lang.Math|) . 
944 Special cases: 
946 If the argument is NaN, then the result is NaN. 
948 If the argument is infinite, then the result is an infinity with the same sign 
949 as the argument. 
951 If the argument is zero, then the result is a zero with the same sign as the 
952 argument. 
956 The computed result must be within 2.5 ulps of the exact result. 
958     x - The number whose hyperbolic sine is to be returned. 
960     Returns: The hyperbolic sine of x. 
961 *java.lang.Math.sqrt(double)*
963 public static double sqrt(double a)
965 Returns the correctly rounded positive square root of a double value. Special 
966 cases: If the argument is NaN or less than zero, then the result is NaN. If the 
967 argument is positive infinity, then the result is positive infinity. If the 
968 argument is positive zero or negative zero, then the result is the same as the 
969 argument. Otherwise, the result is the double value closest to the true 
970 mathematical square root of the argument value. 
972     a - a value. 
974     Returns: the positive square root of a. If the argument is NaN or less than zero, the 
975              result is NaN. 
976 *java.lang.Math.tan(double)*
978 public static double tan(double a)
980 Returns the trigonometric tangent of an angle. Special cases: If the argument 
981 is NaN or an infinity, then the result is NaN. If the argument is zero, then 
982 the result is a zero with the same sign as the argument. 
984 The computed result must be within 1 ulp of the exact result. Results must be 
985 semi-monotonic. 
987     a - an angle, in radians. 
989     Returns: the tangent of the argument. 
990 *java.lang.Math.tanh(double)*
992 public static double tanh(double x)
994 Returns the hyperbolic tangent of a double value. The hyperbolic tangent of x 
995 is defined to be (ex-e-x)/(ex+e-x), in other words, 
996 sinh(<i>x</i>)(|java.lang.Math|) / cosh(<i>x</i>)(|java.lang.Math|) . Note that 
997 the absolute value of the exact tanh is always less than 1. 
999 Special cases: 
1001 If the argument is NaN, then the result is NaN. 
1003 If the argument is zero, then the result is a zero with the same sign as the 
1004 argument. 
1006 If the argument is positive infinity, then the result is +1.0. 
1008 If the argument is negative infinity, then the result is -1.0. 
1012 The computed result must be within 2.5 ulps of the exact result. The result of 
1013 tanh for any finite input must have an absolute value less than or equal to 1. 
1014 Note that once the exact result of tanh is within 1/2 of an ulp of the limit 
1015 value of 1, correctly signed 1.0 should be returned. 
1017     x - The number whose hyperbolic tangent is to be returned. 
1019     Returns: The hyperbolic tangent of x. 
1020 *java.lang.Math.toDegrees(double)*
1022 public static double toDegrees(double angrad)
1024 Converts an angle measured in radians to an approximately equivalent angle 
1025 measured in degrees. The conversion from radians to degrees is generally 
1026 inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0. 
1028     angrad - an angle, in radians 
1030     Returns: the measurement of the angle angrad in degrees. 
1031 *java.lang.Math.toRadians(double)*
1033 public static double toRadians(double angdeg)
1035 Converts an angle measured in degrees to an approximately equivalent angle 
1036 measured in radians. The conversion from degrees to radians is generally 
1037 inexact. 
1039     angdeg - an angle, in degrees 
1041     Returns: the measurement of the angle angdeg in radians. 
1042 *java.lang.Math.ulp(double)*
1044 public static double ulp(double d)
1046 Returns the size of an ulp of the argument. An ulp of a double value is the 
1047 positive distance between this floating-point value and the double value next 
1048 larger in magnitude. Note that for non-NaN x, ulp(-x) == ulp(x). 
1050 Special Cases: 
1052 If the argument is NaN, then the result is NaN. If the argument is positive or 
1053 negative infinity, then the result is positive infinity. If the argument is 
1054 positive or negative zero, then the result is Double.MIN_VALUE. If the argument 
1055 is Double.MAX_VALUE, then the result is equal to 2971. 
1057     d - the floating-point value whose ulp is to be returned 
1059     Returns: the size of an ulp of the argument 
1060 *java.lang.Math.ulp(float)*
1062 public static float ulp(float f)
1064 Returns the size of an ulp of the argument. An ulp of a float value is the 
1065 positive distance between this floating-point value and the float value next 
1066 larger in magnitude. Note that for non-NaN x, ulp(-x) == ulp(x). 
1068 Special Cases: 
1070 If the argument is NaN, then the result is NaN. If the argument is positive or 
1071 negative infinity, then the result is positive infinity. If the argument is 
1072 positive or negative zero, then the result is Float.MIN_VALUE. If the argument 
1073 is Float.MAX_VALUE, then the result is equal to 2104. 
1075     f - the floating-point value whose ulp is to be returned 
1077     Returns: the size of an ulp of the argument