List of utility methods to do Float to
T | floatToBasicType(float f, Class float To Basic Type if (clazz.equals(Boolean.class)) return (T) Boolean.valueOf(floatToBoolean(f)); if (clazz.equals(Byte.class)) return (T) floatToByte(f); if (clazz.equals(Character.class)) return (T) floatToCharacter(f); if (clazz.equals(Short.class)) return (T) floatToShort(f); ... |
String | floatToBinaryStringUnsigned(float value) float To Binary String Unsigned return Integer.toBinaryString(Float.floatToIntBits(Math.abs(value)));
|
char[] | floatToChar(float[] values) float To Char if (values == null) { return null; char[] results = new char[values.length]; for (int i = 0; i < values.length; i++) { results[i] = (char) values[i]; return results; ... |
int | floatToHalf(float f) float To Half int i = Float.floatToRawIntBits(f); int s = (i >> 16) & 0x00008000; int e = ((i >> 23) & 0x000000ff) - (127 - 15); int m = i & 0x007fffff; if (e <= 0) { if (e < -10) { return 0; m = (m | 0x00800000) >> (1 - e); if ((m & 0x00001000) == 0x00001000) m += 0x00002000; return s | (m >> 13); } else if (e == 0xff - (127 - 15)) { if (m == 0) { return s | 0x7c00; } else { m >>= 13; return s | 0x7c00 | m | ((m == 0) ? 0 : 1); } else { if ((m & 0x00001000) == 0x00001000) { m += 0x00002000; if ((m & 0x00800000) == 0x00800000) { m = 0; e += 1; if (e > 30) { return s | 0x7c00; return s | (e << 10) | (m >> 13); |
long | FloatToInt(double x) Float To Int return Math.round(x);
|
int | floatToIntColor(float value) float To Int Color return Float.floatToRawIntBits(value);
|
String | floatToPrefixCoded(float val) Convenience method: this just returns: intToPrefixCoded(floatToSortableInt(val)) return intToPrefixCoded(floatToSortableInt(val)); |
byte[] | floatToRegisters(float f) Converts a float value to a byte[4] binary float value. return intToRegisters(Float.floatToIntBits(f));
|
int | floatToS390IntBits(float ieeeFloat) Converts an IEEE float to an S390 float (as an int). int ieeeIntBits = Float.floatToIntBits(ieeeFloat); boolean positive = ((ieeeIntBits & FLOAT_SIGN_MASK) == 0); if ((ieeeIntBits & 0x7fffffff) == 0) { return ieeeIntBits; int exponent = ieeeIntBits & FLOAT_EXPONENT_MASK; exponent = exponent >>> 23; exponent = exponent - FLOAT_BIAS; ... |
void | floatToSemiPrecision(float f, byte abyte0[], int i) float To Semi Precision int j = Float.floatToIntBits(f); int k = j >> 23; k &= 0xff; int l = j << 9; l >>>= 9; int i1 = l >> 13; int j1 = (j >>> 31) << 15; int k1; ... |