THE PACKAGE JAVA.LANG
java.lang.Math
20.11
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
( 20.8.1), the most neg
ative representable
long
value, the result will be that same negative value.
20.11.23
public static float abs(float a)
The argument is returned with its sign changed to be positive.
Special cases:
If the argument is positive zero or negative zero, the result is positive zero.
If the argument is infinite, the result is positive infinity.
If the argument is NaN, the result is NaN.
In other words, the result is equal to the value of the expression:
Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))
[This specification for the method
abs
is scheduled for introduction in Java
version 1.1. In previous versions of Java,
abs( 0.0f)
returns
0.0f
, which is not
correct.]
20.11.24
public static double abs(double a)
The argument is returned with its sign changed to be positive.
Special cases:
If the argument is positive zero or negative zero, the result is positive zero.
If the argument is infinite, the result is positive infinity.
If the argument is NaN, the result is NaN.
In other words, the result is equal to the value of the expression:
Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)
[This specification for the method
abs
is scheduled for introduction in Java
version 1.1. In previous versions of Java,
abs( 0.0d)
returns
0.0d
, which is not
correct.]
527
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