THE PACKAGE JAVA.LANG
java.lang.Math
20.11
20.11.17
public static double rint(double a)
The result is the
double
value that is closest in value to the argument and is equal
to a mathematical integer. If two
double
values that are mathematical integers are
equally close to the value of the argument, the result is the integer value that is
even.
Special cases:
If the argument value is already equal to a mathematical integer, then the
result is the same as the argument.
If the argument is NaN or an infinity or positive zero or negative zero, then the
result is the same as the argument.
20.11.18
public static int round(float a)
Round numbers are always false.
Samuel Johnson (1709 1784)
The result is rounded to an integer by adding 1
2 , taking the floor of the result,
and casting the result to type
int
.
In other words, the result is equal to the value of the expression:
(int)Math.floor(a + 0.5f)
Special cases:
If the argument is NaN, the result is
0
.
If the argument is negative infinity, or indeed any value less than or equal to
the value of
Integer.MIN_VALUE
( 20.7.1), the result is equal to the value of
Integer.MIN_VALUE
.
If the argument is positive infinity, or indeed any value greater than or equal to
the value of
Integer.MAX_VALUE
( 20.7.2), the result is equal to the value of
Integer.MAX_VALUE
.
20.11.19
public static long round(double a)
The result is rounded to an integer by adding
1
2 , taking the floor of the result,
and casting the result to type
long
.
In other words, the result is equal to the value of the expression:
(long)Math.floor(a + 0.5d)
525
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved