1 *java.lang.StrictMath* *StrictMath* The class StrictMath contains methods for pe
3 public final class StrictMath
4 extends |java.lang.Object|
6 |java.lang.StrictMath_Description|
7 |java.lang.StrictMath_Fields|
8 |java.lang.StrictMath_Constructors|
9 |java.lang.StrictMath_Methods|
11 ================================================================================
13 *java.lang.StrictMath_Fields*
14 |double_java.lang.StrictMath.E|
15 |double_java.lang.StrictMath.PI|
17 *java.lang.StrictMath_Methods*
18 |java.lang.StrictMath.abs(double)|Returns the absolute value of a double value.
19 |java.lang.StrictMath.abs(float)|Returns the absolute value of a float value.
20 |java.lang.StrictMath.abs(int)|Returns the absolute value of an int value..
21 |java.lang.StrictMath.abs(long)|Returns the absolute value of a long value.
22 |java.lang.StrictMath.acos(double)|Returns the arc cosine of an angle, in the r
23 |java.lang.StrictMath.asin(double)|Returns the arc sine of an angle, in the ran
24 |java.lang.StrictMath.atan(double)|Returns the arc tangent of an angle, in the
25 |java.lang.StrictMath.atan2(double,double)|Converts rectangular coordinates (x,
26 |java.lang.StrictMath.cbrt(double)|Returns the cube root of a double value.
27 |java.lang.StrictMath.ceil(double)|Returns the smallest (closest to negative in
28 |java.lang.StrictMath.cos(double)|Returns the trigonometric cosine of an angle.
29 |java.lang.StrictMath.cosh(double)|Returns the hyperbolic cosine of a double va
30 |java.lang.StrictMath.exp(double)|Returns Euler's number e raised to the power
31 |java.lang.StrictMath.expm1(double)|Returns ex-1.
32 |java.lang.StrictMath.floor(double)|Returns the largest (closest to positive in
33 |java.lang.StrictMath.hypot(double,double)|Returns sqrt(x2+y2) without interme
34 |java.lang.StrictMath.IEEEremainder(double,double)|Computes the remainder opera
35 |java.lang.StrictMath.log(double)|Returns the natural logarithm (base e) of a d
36 |java.lang.StrictMath.log10(double)|Returns the base 10 logarithm of a double v
37 |java.lang.StrictMath.log1p(double)|Returns the natural logarithm of the sum of
38 |java.lang.StrictMath.max(double,double)|Returns the greater of two double valu
39 |java.lang.StrictMath.max(float,float)|Returns the greater of two float values.
40 |java.lang.StrictMath.max(int,int)|Returns the greater of two int values.
41 |java.lang.StrictMath.max(long,long)|Returns the greater of two long values.
42 |java.lang.StrictMath.min(double,double)|Returns the smaller of two double valu
43 |java.lang.StrictMath.min(float,float)|Returns the smaller of two float values.
44 |java.lang.StrictMath.min(int,int)|Returns the smaller of two int values.
45 |java.lang.StrictMath.min(long,long)|Returns the smaller of two long values.
46 |java.lang.StrictMath.pow(double,double)|Returns the value of the first argumen
47 |java.lang.StrictMath.random()|Returns a double value with a positive sign, gre
48 |java.lang.StrictMath.rint(double)|Returns the double value that is closest in
49 |java.lang.StrictMath.round(double)|Returns the closest long to the argument.
50 |java.lang.StrictMath.round(float)|Returns the closest int to the argument.
51 |java.lang.StrictMath.signum(double)|Returns the signum function of the argumen
52 |java.lang.StrictMath.signum(float)|Returns the signum function of the argument
53 |java.lang.StrictMath.sin(double)|Returns the trigonometric sine of an angle.
54 |java.lang.StrictMath.sinh(double)|Returns the hyperbolic sine of a double valu
55 |java.lang.StrictMath.sqrt(double)|Returns the correctly rounded positive squar
56 |java.lang.StrictMath.tan(double)|Returns the trigonometric tangent of an angle
57 |java.lang.StrictMath.tanh(double)|Returns the hyperbolic tangent of a double v
58 |java.lang.StrictMath.toDegrees(double)|Converts an angle measured in radians t
59 |java.lang.StrictMath.toRadians(double)|Converts an angle measured in degrees t
60 |java.lang.StrictMath.ulp(double)|Returns the size of an ulp of the argument.
61 |java.lang.StrictMath.ulp(float)|Returns the size of an ulp of the argument.
63 *java.lang.StrictMath_Description*
65 The class StrictMath contains methods for performing basic numeric operations
66 such as the elementary exponential, logarithm, square root, and trigonometric
69 To help ensure portability of Java programs, the definitions of some of the
70 numeric functions in this package require that they produce the same results as
71 certain published algorithms. These algorithms are available from the
72 well-known network library netlib as the package "Freely Distributable Math
73 Library," fdlibm. These algorithms, which are written in the C programming
74 language, are then to be understood as executed with all floating-point
75 operations following the rules of Java floating-point arithmetic.
77 The Java math library is defined with respect to fdlibm version 5.3. Where
78 fdlibm provides more than one definition for a function (such as acos), use the
79 "IEEE 754 core function" version (residing in a file whose name begins with the
80 letter e). The methods which require fdlibm semantics are sin, cos, tan, asin,
81 acos, atan, exp, log, log10, cbrt, atan2, pow, sinh, cosh, tanh, hypot, expm1,
85 *double_java.lang.StrictMath.E*
87 The class StrictMath contains methods for performing basic numeric operations
88 such as the elementary exponential, logarithm, square root, and trigonometric
91 To help ensure portability of Java programs, the definitions of some of the
92 numeric functions in this package require that they produce the same results as
93 certain published algorithms. These algorithms are available from the
94 well-known network library netlib as the package "Freely Distributable Math
95 Library," fdlibm. These algorithms, which are written in the C programming
96 language, are then to be understood as executed with all floating-point
97 operations following the rules of Java floating-point arithmetic.
99 The Java math library is defined with respect to fdlibm version 5.3. Where
100 fdlibm provides more than one definition for a function (such as acos), use the
101 "IEEE 754 core function" version (residing in a file whose name begins with the
102 letter e). The methods which require fdlibm semantics are sin, cos, tan, asin,
103 acos, atan, exp, log, log10, cbrt, atan2, pow, sinh, cosh, tanh, hypot, expm1,
107 *double_java.lang.StrictMath.PI*
109 The class StrictMath contains methods for performing basic numeric operations
110 such as the elementary exponential, logarithm, square root, and trigonometric
113 To help ensure portability of Java programs, the definitions of some of the
114 numeric functions in this package require that they produce the same results as
115 certain published algorithms. These algorithms are available from the
116 well-known network library netlib as the package "Freely Distributable Math
117 Library," fdlibm. These algorithms, which are written in the C programming
118 language, are then to be understood as executed with all floating-point
119 operations following the rules of Java floating-point arithmetic.
121 The Java math library is defined with respect to fdlibm version 5.3. Where
122 fdlibm provides more than one definition for a function (such as acos), use the
123 "IEEE 754 core function" version (residing in a file whose name begins with the
124 letter e). The methods which require fdlibm semantics are sin, cos, tan, asin,
125 acos, atan, exp, log, log10, cbrt, atan2, pow, sinh, cosh, tanh, hypot, expm1,
130 *java.lang.StrictMath.abs(double)*
132 public static double abs(double a)
134 Returns the absolute value of a double value. If the argument is not negative,
135 the argument is returned. If the argument is negative, the negation of the
136 argument is returned. Special cases: If the argument is positive zero or
137 negative zero, the result is positive zero. If the argument is infinite, the
138 result is positive infinity. If the argument is NaN, the result is NaN. In
139 other words, the result is the same as the value of the expression:
140 Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)
142 a - the argument whose absolute value is to be determined
144 Returns: the absolute value of the argument.
145 *java.lang.StrictMath.abs(float)*
147 public static float abs(float a)
149 Returns the absolute value of a float value. If the argument is not negative,
150 the argument is returned. If the argument is negative, the negation of the
151 argument is returned. Special cases: If the argument is positive zero or
152 negative zero, the result is positive zero. If the argument is infinite, the
153 result is positive infinity. If the argument is NaN, the result is NaN. In
154 other words, the result is the same as the value of the expression:
156 Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))
158 a - the argument whose absolute value is to be determined
160 Returns: the absolute value of the argument.
161 *java.lang.StrictMath.abs(int)*
163 public static int abs(int a)
165 Returns the absolute value of an int value.. If the argument is not negative,
166 the argument is returned. If the argument is negative, the negation of the
167 argument is returned.
169 Note that if the argument is equal to the value of Integer.MIN_VALUE, the most
170 negative representable int value, the result is that same value, which is
173 a - the argument whose absolute value is to be determined.
175 Returns: the absolute value of the argument.
176 *java.lang.StrictMath.abs(long)*
178 public static long abs(long a)
180 Returns the absolute value of a long value. If the argument is not negative,
181 the argument is returned. If the argument is negative, the negation of the
182 argument is returned.
184 Note that if the argument is equal to the value of Long.MIN_VALUE, the most
185 negative representable long value, the result is that same value, which is
188 a - the argument whose absolute value is to be determined.
190 Returns: the absolute value of the argument.
191 *java.lang.StrictMath.acos(double)*
193 public static native double acos(double a)
195 Returns the arc cosine of an angle, in the range of 0.0 through pi. Special
196 case: If the argument is NaN or its absolute value is greater than 1, then the
199 a - the value whose arc cosine is to be returned.
201 Returns: the arc cosine of the argument.
202 *java.lang.StrictMath.asin(double)*
204 public static native double asin(double a)
206 Returns the arc sine of an angle, in the range of -pi/2 through pi/2. Special
207 cases: If the argument is NaN or its absolute value is greater than 1, then the
208 result is NaN. If the argument is zero, then the result is a zero with the same
209 sign as the argument.
211 a - the value whose arc sine is to be returned.
213 Returns: the arc sine of the argument.
214 *java.lang.StrictMath.atan(double)*
216 public static native double atan(double a)
218 Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
219 Special cases: If the argument is NaN, then the result is NaN. If the argument
220 is zero, then the result is a zero with the same sign as the argument.
222 a - the value whose arc tangent is to be returned.
224 Returns: the arc tangent of the argument.
225 *java.lang.StrictMath.atan2(double,double)*
227 public static native double atan2(
231 Converts rectangular coordinates (x,y) to polar (r,theta). This method computes
232 the phase theta by computing an arc tangent of y/x in the range of -pi to pi.
233 Special cases: If either argument is NaN, then the result is NaN. If the first
234 argument is positive zero and the second argument is positive, or the first
235 argument is positive and finite and the second argument is positive infinity,
236 then the result is positive zero. If the first argument is negative zero and
237 the second argument is positive, or the first argument is negative and finite
238 and the second argument is positive infinity, then the result is negative zero.
239 If the first argument is positive zero and the second argument is negative, or
240 the first argument is positive and finite and the second argument is negative
241 infinity, then the result is the double value closest to pi. If the first
242 argument is negative zero and the second argument is negative, or the first
243 argument is negative and finite and the second argument is negative infinity,
244 then the result is the double value closest to -pi. If the first argument is
245 positive and the second argument is positive zero or negative zero, or the
246 first argument is positive infinity and the second argument is finite, then the
247 result is the double value closest to pi/2. If the first argument is negative
248 and the second argument is positive zero or negative zero, or the first
249 argument is negative infinity and the second argument is finite, then the
250 result is the double value closest to -pi/2. If both arguments are positive
251 infinity, then the result is the double value closest to pi/4. If the first
252 argument is positive infinity and the second argument is negative infinity,
253 then the result is the double value closest to 3*pi/4. If the first argument is
254 negative infinity and the second argument is positive infinity, then the result
255 is the double value closest to -pi/4. If both arguments are negative infinity,
256 then the result is the double value closest to -3*pi/4.
258 y - the ordinate coordinate
259 x - the abscissa coordinate
261 Returns: the theta component of the point (r,theta) in polar coordinates that
262 corresponds to the point (x,y) in Cartesian coordinates.
263 *java.lang.StrictMath.cbrt(double)*
265 public static native double cbrt(double a)
267 Returns the cube root of a double value. For positive finite x, cbrt(-x) ==
268 -cbrt(x); that is, the cube root of a negative value is the negative of the
269 cube root of that value's magnitude. Special cases:
273 If the argument is NaN, then the result is NaN.
275 If the argument is infinite, then the result is an infinity with the same sign
278 If the argument is zero, then the result is a zero with the same sign as the
285 Returns: the cube root of a.
286 *java.lang.StrictMath.ceil(double)*
288 public static native double ceil(double a)
290 Returns the smallest (closest to negative infinity) double value that is
291 greater than or equal to the argument and is equal to a mathematical integer.
292 Special cases: If the argument value is already equal to a mathematical
293 integer, then the result is the same as the argument. If the argument is NaN or
294 an infinity or positive zero or negative zero, then the result is the same as
295 the argument. If the argument value is less than zero but greater than -1.0,
296 then the result is negative zero. Note that the value of StrictMath.ceil(x) is
297 exactly the value of -StrictMath.floor(-x).
301 Returns: the smallest (closest to negative infinity) floating-point value that is
302 greater than or equal to the argument and is equal to a
303 mathematical integer.
304 *java.lang.StrictMath.cos(double)*
306 public static native double cos(double a)
308 Returns the trigonometric cosine of an angle. Special cases: If the argument is
309 NaN or an infinity, then the result is NaN.
311 a - an angle, in radians.
313 Returns: the cosine of the argument.
314 *java.lang.StrictMath.cosh(double)*
316 public static native double cosh(double x)
318 Returns the hyperbolic cosine of a double value. The hyperbolic cosine of x is
319 defined to be (ex+e-x)/2 where e is Euler's number(|java.lang.Math|) .
323 If the argument is NaN, then the result is NaN.
325 If the argument is infinite, then the result is positive infinity.
327 If the argument is zero, then the result is 1.0.
331 x - The number whose hyperbolic cosine is to be returned.
333 Returns: The hyperbolic cosine of x.
334 *java.lang.StrictMath.exp(double)*
336 public static native double exp(double a)
338 Returns Euler's number e raised to the power of a double value. Special cases:
339 If the argument is NaN, the result is NaN. If the argument is positive
340 infinity, then the result is positive infinity. If the argument is negative
341 infinity, then the result is positive zero.
343 a - the exponent to raise e to.
345 Returns: the value ea, where e is the base of the natural logarithms.
346 *java.lang.StrictMath.expm1(double)*
348 public static native double expm1(double x)
350 Returns ex-1. Note that for values of x near 0, the exact sum of expm1(x)+1 is
351 much closer to the true result of ex than exp(x).
355 If the argument is NaN, the result is NaN.
357 If the argument is positive infinity, then the result is positive infinity.
359 If the argument is negative infinity, then the result is -1.0.
361 If the argument is zero, then the result is a zero with the same sign as the
366 x - the exponent to raise e to in the computation of ex-1.
368 Returns: the value ex-1.
369 *java.lang.StrictMath.floor(double)*
371 public static native double floor(double a)
373 Returns the largest (closest to positive infinity) double value that is less
374 than or equal to the argument and is equal to a mathematical integer. Special
375 cases: If the argument value is already equal to a mathematical integer, then
376 the result is the same as the argument. If the argument is NaN or an infinity
377 or positive zero or negative zero, then the result is the same as the argument.
381 Returns: the largest (closest to positive infinity) floating-point value that less than
382 or equal to the argument and is equal to a mathematical integer.
383 *java.lang.StrictMath.hypot(double,double)*
385 public static native double hypot(
389 Returns sqrt(x2+y2) without intermediate overflow or underflow.
393 If either argument is infinite, then the result is positive infinity.
395 If either argument is NaN and neither argument is infinite, then the result is
403 Returns: sqrt(x2+y2) without intermediate overflow or underflow
404 *java.lang.StrictMath.IEEEremainder(double,double)*
406 public static native double IEEEremainder(
410 Computes the remainder operation on two arguments as prescribed by the IEEE 754
411 standard. The remainder value is mathematically equal to f1-f2n, where n is the
412 mathematical integer closest to the exact mathematical value of the quotient
413 f1/f2, and if two mathematical integers are equally close to f1/f2, then n is
414 the integer that is even. If the remainder is zero, its sign is the same as the
415 sign of the first argument. Special cases: If either argument is NaN, or the
416 first argument is infinite, or the second argument is positive zero or negative
417 zero, then the result is NaN. If the first argument is finite and the second
418 argument is infinite, then the result is the same as the first argument.
423 Returns: the remainder when f1 is divided by f2.
424 *java.lang.StrictMath.log(double)*
426 public static native double log(double a)
428 Returns the natural logarithm (base e) of a double value. Special cases: If the
429 argument is NaN or less than zero, then the result is NaN. If the argument is
430 positive infinity, then the result is positive infinity. If the argument is
431 positive zero or negative zero, then the result is negative infinity.
435 Returns: the value lna, the natural logarithm of a.
436 *java.lang.StrictMath.log10(double)*
438 public static native double log10(double a)
440 Returns the base 10 logarithm of a double value. Special cases:
442 If the argument is NaN or less than zero, then the result is NaN. If the
443 argument is positive infinity, then the result is positive infinity. If the
444 argument is positive zero or negative zero, then the result is negative
445 infinity. If the argument is equal to 10n for integer n, then the result is n.
449 Returns: the base 10 logarithm of a.
450 *java.lang.StrictMath.log1p(double)*
452 public static native double log1p(double x)
454 Returns the natural logarithm of the sum of the argument and 1. Note that for
455 small values x, the result of log1p(x) is much closer to the true result of
456 ln(1 + x) than the floating-point evaluation of log(1.0+x).
462 If the argument is NaN or less than -1, then the result is NaN.
464 If the argument is positive infinity, then the result is positive infinity.
466 If the argument is negative one, then the result is negative infinity.
468 If the argument is zero, then the result is a zero with the same sign as the
475 Returns: the value ln(x+1), the natural log of x+1
476 *java.lang.StrictMath.max(double,double)*
478 public static double max(
482 Returns the greater of two double values. That is, the result is the argument
483 closer to positive infinity. If the arguments have the same value, the result
484 is that same value. If either value is NaN, then the result is NaN. Unlike the
485 numerical comparison operators, this method considers negative zero to be
486 strictly smaller than positive zero. If one argument is positive zero and the
487 other negative zero, the result is positive zero.
490 b - another argument.
492 Returns: the larger of a and b.
493 *java.lang.StrictMath.max(float,float)*
495 public static float max(
499 Returns the greater of two float values. That is, the result is the argument
500 closer to positive infinity. If the arguments have the same value, the result
501 is that same value. If either value is NaN, then the result is NaN. Unlike the
502 numerical comparison operators, this method considers negative zero to be
503 strictly smaller than positive zero. If one argument is positive zero and the
504 other negative zero, the result is positive zero.
507 b - another argument.
509 Returns: the larger of a and b.
510 *java.lang.StrictMath.max(int,int)*
512 public static int max(
516 Returns the greater of two int values. That is, the result is the argument
517 closer to the value of Integer.MAX_VALUE. If the arguments have the same value,
518 the result is that same value.
521 b - another argument.
523 Returns: the larger of a and b.
524 *java.lang.StrictMath.max(long,long)*
526 public static long max(
530 Returns the greater of two long values. That is, the result is the argument
531 closer to the value of Long.MAX_VALUE. If the arguments have the same value,
532 the result is that same value.
535 b - another argument.
537 Returns: the larger of a and b.
538 *java.lang.StrictMath.min(double,double)*
540 public static double min(
544 Returns the smaller of two double values. That is, the result is the value
545 closer to negative infinity. If the arguments have the same value, the result
546 is that same value. If either value is NaN, then the result is NaN. Unlike the
547 numerical comparison operators, this method considers negative zero to be
548 strictly smaller than positive zero. If one argument is positive zero and the
549 other is negative zero, the result is negative zero.
552 b - another argument.
554 Returns: the smaller of a and b.
555 *java.lang.StrictMath.min(float,float)*
557 public static float min(
561 Returns the smaller of two float values. That is, the result is the value
562 closer to negative infinity. If the arguments have the same value, the result
563 is that same value. If either value is NaN, then the result is NaN. Unlike the
564 numerical comparison operators, this method considers negative zero to be
565 strictly smaller than positive zero. If one argument is positive zero and the
566 other is negative zero, the result is negative zero.
569 b - another argument.
571 Returns: the smaller of a and b.
572 *java.lang.StrictMath.min(int,int)*
574 public static int min(
578 Returns the smaller of two int values. That is, the result the argument closer
579 to the value of Integer.MIN_VALUE. If the arguments have the same value, the
580 result is that same value.
583 b - another argument.
585 Returns: the smaller of a and b.
586 *java.lang.StrictMath.min(long,long)*
588 public static long min(
592 Returns the smaller of two long values. That is, the result is the argument
593 closer to the value of Long.MIN_VALUE. If the arguments have the same value,
594 the result is that same value.
597 b - another argument.
599 Returns: the smaller of a and b.
600 *java.lang.StrictMath.pow(double,double)*
602 public static native double pow(
606 Returns the value of the first argument raised to the power of the second
607 argument. Special cases:
609 If the second argument is positive or negative zero, then the result is 1.0. If
610 the second argument is 1.0, then the result is the same as the first argument.
611 If the second argument is NaN, then the result is NaN. If the first argument is
612 NaN and the second argument is nonzero, then the result is NaN.
616 the absolute value of the first argument is greater than 1 and the second
617 argument is positive infinity, or the absolute value of the first argument is
618 less than 1 and the second argument is negative infinity,
620 then the result is positive infinity.
624 the absolute value of the first argument is greater than 1 and the second
625 argument is negative infinity, or the absolute value of the first argument is
626 less than 1 and the second argument is positive infinity,
628 then the result is positive zero.
630 If the absolute value of the first argument equals 1 and the second argument is
631 infinite, then the result is NaN.
635 the first argument is positive zero and the second argument is greater than
636 zero, or the first argument is positive infinity and the second argument is
639 then the result is positive zero.
643 the first argument is positive zero and the second argument is less than zero,
644 or the first argument is positive infinity and the second argument is greater
647 then the result is positive infinity.
651 the first argument is negative zero and the second argument is greater than
652 zero but not a finite odd integer, or the first argument is negative infinity
653 and the second argument is less than zero but not a finite odd integer,
655 then the result is positive zero.
659 the first argument is negative zero and the second argument is a positive
660 finite odd integer, or the first argument is negative infinity and the second
661 argument is a negative finite odd integer,
663 then the result is negative zero.
667 the first argument is negative zero and the second argument is less than zero
668 but not a finite odd integer, or the first argument is negative infinity and
669 the second argument is greater than zero but not a finite odd integer,
671 then the result is positive infinity.
675 the first argument is negative zero and the second argument is a negative
676 finite odd integer, or the first argument is negative infinity and the second
677 argument is a positive finite odd integer,
679 then the result is negative infinity.
681 If the first argument is finite and less than zero
683 if the second argument is a finite even integer, the result is equal to the
684 result of raising the absolute value of the first argument to the power of the
687 if the second argument is a finite odd integer, the result is equal to the
688 negative of the result of raising the absolute value of the first argument to
689 the power of the second argument
691 if the second argument is finite and not an integer, then the result is NaN.
693 If both arguments are integers, then the result is exactly equal to the
694 mathematical result of raising the first argument to the power of the second
695 argument if that result can in fact be represented exactly as a double value.
697 (In the foregoing descriptions, a floating-point value is considered to be an
698 integer if and only if it is finite and a fixed point of the method
699 <tt>ceil</tt>(|java.lang.StrictMath|) or, equivalently, a fixed point of the
700 method <tt>floor</tt>(|java.lang.StrictMath|) . A value is a fixed point of a
701 one-argument method if and only if the result of applying the method to the
702 value is equal to the value.)
707 Returns: the value ab.
708 *java.lang.StrictMath.random()*
710 public static double random()
712 Returns a double value with a positive sign, greater than or equal to 0.0 and
713 less than 1.0. Returned values are chosen pseudorandomly with (approximately)
714 uniform distribution from that range.
716 When this method is first called, it creates a single new pseudorandom-number
717 generator, exactly as if by the expression
719 new java.util.Random This new pseudorandom-number generator is used thereafter
720 for all calls to this method and is used nowhere else.
722 This method is properly synchronized to allow correct use by more than one
723 thread. However, if many threads need to generate pseudorandom numbers at a
724 great rate, it may reduce contention for each thread to have its own
725 pseudorandom number generator.
728 Returns: a pseudorandom double greater than or equal to 0.0 and less than 1.0.
729 *java.lang.StrictMath.rint(double)*
731 public static double rint(double a)
733 Returns the double value that is closest in value to the argument and is equal
734 to a mathematical integer. If two double values that are mathematical integers
735 are equally close to the value of the argument, the result is the integer value
736 that is even. Special cases: If the argument value is already equal to a
737 mathematical integer, then the result is the same as the argument. If the
738 argument is NaN or an infinity or positive zero or negative zero, then the
739 result is the same as the argument.
743 Returns: the closest floating-point value to a that is equal to a mathematical integer.
744 *java.lang.StrictMath.round(double)*
746 public static long round(double a)
748 Returns the closest long to the argument. The result is rounded to an integer
749 by adding 1/2, taking the floor of the result, and casting the result to type
750 long. In other words, the result is equal to the value of the expression:
752 (long)Math.floor(a + 0.5d)
754 Special cases: If the argument is NaN, the result is 0. If the argument is
755 negative infinity or any value less than or equal to the value of
756 Long.MIN_VALUE, the result is equal to the value of Long.MIN_VALUE. If the
757 argument is positive infinity or any value greater than or equal to the value
758 of Long.MAX_VALUE, the result is equal to the value of Long.MAX_VALUE.
760 a - a floating-point value to be rounded to a long.
762 Returns: the value of the argument rounded to the nearest long value.
763 *java.lang.StrictMath.round(float)*
765 public static int round(float a)
767 Returns the closest int to the argument. The result is rounded to an integer by
768 adding 1/2, taking the floor of the result, and casting the result to type int.
769 In other words, the result is equal to the value of the expression:
771 (int)Math.floor(a + 0.5f)
773 Special cases: If the argument is NaN, the result is 0. If the argument is
774 negative infinity or any value less than or equal to the value of
775 Integer.MIN_VALUE, the result is equal to the value of Integer.MIN_VALUE. If
776 the argument is positive infinity or any value greater than or equal to the
777 value of Integer.MAX_VALUE, the result is equal to the value of
780 a - a floating-point value to be rounded to an integer.
782 Returns: the value of the argument rounded to the nearest int value.
783 *java.lang.StrictMath.signum(double)*
785 public static double signum(double d)
787 Returns the signum function of the argument; zero if the argument is zero, 1.0
788 if the argument is greater than zero, -1.0 if the argument is less than zero.
792 If the argument is NaN, then the result is NaN. If the argument is positive
793 zero or negative zero, then the result is the same as the argument.
795 d - the floating-point value whose signum is to be returned
797 Returns: the signum function of the argument
798 *java.lang.StrictMath.signum(float)*
800 public static float signum(float f)
802 Returns the signum function of the argument; zero if the argument is zero, 1.0f
803 if the argument is greater than zero, -1.0f if the argument is less than zero.
807 If the argument is NaN, then the result is NaN. If the argument is positive
808 zero or negative zero, then the result is the same as the argument.
810 f - the floating-point value whose signum is to be returned
812 Returns: the signum function of the argument
813 *java.lang.StrictMath.sin(double)*
815 public static native double sin(double a)
817 Returns the trigonometric sine of an angle. Special cases: If the argument is
818 NaN or an infinity, then the result is NaN. If the argument is zero, then the
819 result is a zero with the same sign as the argument.
821 a - an angle, in radians.
823 Returns: the sine of the argument.
824 *java.lang.StrictMath.sinh(double)*
826 public static native double sinh(double x)
828 Returns the hyperbolic sine of a double value. The hyperbolic sine of x is
829 defined to be (ex-e-x)/2 where e is Euler's number(|java.lang.Math|) .
833 If the argument is NaN, then the result is NaN.
835 If the argument is infinite, then the result is an infinity with the same sign
838 If the argument is zero, then the result is a zero with the same sign as the
843 x - The number whose hyperbolic sine is to be returned.
845 Returns: The hyperbolic sine of x.
846 *java.lang.StrictMath.sqrt(double)*
848 public static native double sqrt(double a)
850 Returns the correctly rounded positive square root of a double value. Special
851 cases: If the argument is NaN or less than zero, then the result is NaN. If the
852 argument is positive infinity, then the result is positive infinity. If the
853 argument is positive zero or negative zero, then the result is the same as the
854 argument. Otherwise, the result is the double value closest to the true
855 mathematical square root of the argument value.
859 Returns: the positive square root of a.
860 *java.lang.StrictMath.tan(double)*
862 public static native double tan(double a)
864 Returns the trigonometric tangent of an angle. Special cases: If the argument
865 is NaN or an infinity, then the result is NaN. If the argument is zero, then
866 the result is a zero with the same sign as the argument.
868 a - an angle, in radians.
870 Returns: the tangent of the argument.
871 *java.lang.StrictMath.tanh(double)*
873 public static native double tanh(double x)
875 Returns the hyperbolic tangent of a double value. The hyperbolic tangent of x
876 is defined to be (ex-e-x)/(ex+e-x), in other words,
877 sinh(<i>x</i>)(|java.lang.Math|) / cosh(<i>x</i>)(|java.lang.Math|) . Note that
878 the absolute value of the exact tanh is always less than 1.
882 If the argument is NaN, then the result is NaN.
884 If the argument is zero, then the result is a zero with the same sign as the
887 If the argument is positive infinity, then the result is +1.0.
889 If the argument is negative infinity, then the result is -1.0.
893 x - The number whose hyperbolic tangent is to be returned.
895 Returns: The hyperbolic tangent of x.
896 *java.lang.StrictMath.toDegrees(double)*
898 public static double toDegrees(double angrad)
900 Converts an angle measured in radians to an approximately equivalent angle
901 measured in degrees. The conversion from radians to degrees is generally
902 inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0.
904 angrad - an angle, in radians
906 Returns: the measurement of the angle angrad in degrees.
907 *java.lang.StrictMath.toRadians(double)*
909 public static double toRadians(double angdeg)
911 Converts an angle measured in degrees to an approximately equivalent angle
912 measured in radians. The conversion from degrees to radians is generally
915 angdeg - an angle, in degrees
917 Returns: the measurement of the angle angdeg in radians.
918 *java.lang.StrictMath.ulp(double)*
920 public static double ulp(double d)
922 Returns the size of an ulp of the argument. An ulp of a double value is the
923 positive distance between this floating-point value and the double value next
924 larger in magnitude. Note that for non-NaN x, ulp(-x) == ulp(x).
928 If the argument is NaN, then the result is NaN. If the argument is positive or
929 negative infinity, then the result is positive infinity. If the argument is
930 positive or negative zero, then the result is Double.MIN_VALUE. If the argument
931 is Double.MAX_VALUE, then the result is equal to 2971.
933 d - the floating-point value whose ulp is to be returned
935 Returns: the size of an ulp of the argument
936 *java.lang.StrictMath.ulp(float)*
938 public static float ulp(float f)
940 Returns the size of an ulp of the argument. An ulp of a float value is the
941 positive distance between this floating-point value and the float value next
942 larger in magnitude. Note that for non-NaN x, ulp(-x) == ulp(x).
946 If the argument is NaN, then the result is NaN. If the argument is positive or
947 negative infinity, then the result is positive infinity. If the argument is
948 positive or negative zero, then the result is Float.MIN_VALUE. If the argument
949 is Float.MAX_VALUE, then the result is equal to 2104.
951 f - the floating-point value whose ulp is to be returned
953 Returns: the size of an ulp of the argument