Java Reference
In-Depth Information
Function
Value
signum function: 1 if x is positive; 1 if x is
negative; 0 if x is zero. There are double and
float versions
signum(x)
Smallest whole number
x
ceil(x)
Largest whole number
x
floor(x)
x rounded to the nearest integer; if neither in-
teger is nearer, rounds to the even integer
rint(x)
(int) floor(x + 0.5) for float x (long) floor(x
+ 0.5) for double x
round(x)
| x | for any numeric type. (the absolute value
of the most negative value of an int or long is
itself and therefore negative; that's how two's
complement integers work)
abs(x)
Larger of x and y for any numeric type
max(x,y)
Smaller of x and y for any numeric type
min(x,y)
Calculates the length of the hypotenuse of a
right-angled triangle with sides of length x
and y ; that is, it calculates
hypot(x,y)
with no in-
termediate overflow or underflow
Search WWH ::




Custom Search