Java Reference
In-Depth Information
2.7182818284590452354
public static final double PI
The double value that is closer than any other to the ratio of the circumfer-
ence of a circle to its diameter. The actual value is:
3.14159265358979323846
Absolute value
The method abs()returns the absolute value of the operand,which can be a
double,a float,and int,or a long in the various implementations.
public static int abs(int a)
Returns the absolute value of an int operand. If the argument is positive the
same value is returned. If the argument is negative,the negation of the oper -
and value is returned. If the argument is equal to the value of Inte-
ger.MIN_VALUE the result is that same value,which is negative.
public static long abs(long a)
Returns the absolute value of a long operand. If the argument is not nega-
tive,the same value is returned. If the argument is negative,the negation of
the argument is returned.
Note that if the argument is equal to the value of Long.MIN_VALUE the
result is that same value,which is negative.
public static float abs(float a)
Returns the absolute value of a float operand. If the argument is not nega-
tive,the same value is returned. If the argument is negative,the negation of
the argument is returned. The following are special cases:
1. If the argument is positive zero or negative zero,the result is positive zero.
2. If the argument is infinite,the result is positive infinity.
3. If the argument is NaN,the result is NaN.
public static double abs(double a)
Returns the absolute value of a double operand. If the argument is not nega-
tive,the same value is returned. If the argument is negative,the negation of
the argument is returned. The following are special cases:
1. If the argument is positive zero or negative zero,the result is positive zero.
2. If the argument is infinite,the result is positive infinity.
3. If the argument is NaN,the result is NaN.
Search WWH ::




Custom Search