Java Utililty Methods Float to Bit

List of utility methods to do Float to Bit

Description

The list of methods to do Float to Bit are organized into topic(s).

Method

intfloatToIntBits(final float f)
Returns the representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, after first mapping -0.0 to 0.0.
return ((f == 0.0f) ? 0 : Float.floatToIntBits(f));
intfloatToIntBits(float value)
float To Int Bits
if (Float.isNaN(value)) {
    return 0x7fc00000;
int signBit;
if (value == 0) {
    return (1 / value == Float.NEGATIVE_INFINITY) ? 0x80000000 : 0;
} else if (value < 0) {
    value = -value;
...
intfloatToIntBits(float value)
float To Int Bits
return Float.floatToIntBits(value);
shortfloatToShortBits(float fval)
float To Short Bits
int fbits = Float.floatToIntBits(fval);
int sign = fbits >>> 16 & 0x8000;
int val = (fbits & 0x7fffffff) + 0x1000;
if (val >= 0x47800000) {
    if ((fbits & 0x7fffffff) >= 0x47800000) {
        if (val < 0x7f800000)
            return (short) (sign | 0x7c00);
        return (short) (sign | 0x7c00 | (fbits & 0x007fffff) >>> 13);
...