|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Number java.lang.Float
public final class Float
Minimal Float implementation.
Field Summary | |
---|---|
static int |
MAX_EXPONENT
|
static float |
MAX_VALUE
|
static int |
MIN_EXPONENT
|
static float |
MIN_NORMAL
|
static float |
MIN_VALUE
|
static float |
NaN
|
static float |
NEGATIVE_INFINITY
|
static float |
POSITIVE_INFINITY
|
static int |
SIZE
|
static Class<?> |
TYPE
|
Constructor Summary | |
---|---|
Float(double value)
|
|
Float(float value)
Constructs a newly allocated Float object that represents the primitive float argument. |
|
Float(String s)
|
Method Summary | |
---|---|
byte |
byteValue()
Return the byte value of this Number. |
double |
doubleValue()
Return the double value of this Number. |
boolean |
equals(Object o)
|
static int |
floatToIntBits(float value)
Returns the bit representation of a single-float value. |
static int |
floatToRawIntBits(float value)
Returns the bit representation of a single-float value. |
float |
floatValue()
Returns the float value of this Float object. |
int |
hashCode()
|
static float |
intBitsToFloat(int value)
Returns the single-float corresponding to a given bit represention. |
int |
intValue()
Return the int value of this Number. |
boolean |
isInfinite()
|
static boolean |
isInfinite(float v)
|
boolean |
isNaN()
|
static boolean |
isNaN(float val)
|
long |
longValue()
Return the long value of this Number. |
static float |
parseFloat(String s)
Converts a String value into a float |
short |
shortValue()
Return the short value of this Number. |
String |
toString()
|
static String |
toString(float f)
Convert a float to a String |
static Float |
valueOf(float f)
|
static Float |
valueOf(String s)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final float POSITIVE_INFINITY
public static final float NEGATIVE_INFINITY
public static final float NaN
public static final int MAX_EXPONENT
public static final float MAX_VALUE
public static final int MIN_EXPONENT
public static final float MIN_NORMAL
public static final float MIN_VALUE
public static final int SIZE
public static final Class<?> TYPE
Constructor Detail |
---|
public Float(double value)
public Float(float value)
value
- - the value to be represented by the Float.public Float(String s)
Method Detail |
---|
public byte byteValue()
Number
byteValue
in class Number
public double doubleValue()
Number
doubleValue
in class Number
public boolean equals(Object o)
equals
in class Object
public static int floatToRawIntBits(float value)
0x80000000
) represents the sign of the floating-point
number.
0x7f800000
) represent the exponent.
0x007fffff
) represent the significand (sometimes called
the mantissa) of the floating-point number.
0x7f800000
.
0xff800000
.
If the argument is NaN, the result is the integer representing the actual NaN value.
intBitsToFloat(int)
method, will produce a floating-point
value equal to the argument to floatToRawIntBits
.
value
- a floating-point number.
public static int floatToIntBits(float value)
floatToRawIntBits
this
method does collapse all NaN values into a standard single value. This
value is 0x7fc00000
.
value
- a floating-point number.
public float floatValue()
floatValue
in class Number
public int hashCode()
hashCode
in class Object
public static float intBitsToFloat(int value)
If the argument is 0x7f800000
, the result is positive
infinity.
If the argument is 0xff800000
, the result is negative
infinity.
If the argument is any value in the range 0x7f800001
through 0x7fffffff
or in the range
0xff800001
through 0xffffffff
, the result is
NaN. All IEEE 754 NaN values of type float
are, in effect,
lumped together by the Java programming language into a single
float
value called NaN. Distinct values of NaN are only
accessible by use of the Float.floatToRawIntBits
method.
In all other cases, let s, e, and m be three values that can be computed from the argument:
Then the floating-point result equals the value of the mathematical expression s·m·2e-150.int s = ((bits >> 31) == 0) ? 1 : -1; int e = ((bits >> 23) & 0xff); int m = (e == 0) ? (bits & 0x7fffff) << 1 : (bits & 0x7fffff) | 0x800000;
value
- an integer.
public int intValue()
Number
intValue
in class Number
public boolean isInfinite()
public static boolean isInfinite(float v)
public boolean isNaN()
public static boolean isNaN(float val)
public long longValue()
Number
longValue
in class Number
public static float parseFloat(String s) throws NumberFormatException
s
- String representation of float. Must only contain numbers and an optional decimal, and optional - sign at front.
NumberFormatException
public short shortValue()
Number
shortValue
in class Number
public String toString()
toString
in class Object
public static String toString(float f)
f
- the float to be converted
public static Float valueOf(float f)
public static Float valueOf(String s)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |