java.lang.Object | |
↳ | org.apache.lucene.util.SmallFloat |
Floating point numbers smaller than 32 bits.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
byteToFloat(b, mantissaBits=3, zeroExponent=15)
| |||||||||||
byteToFloat(b, mantissaBits=5, zeroExponent=2)
| |||||||||||
Converts an 8 bit float to a 32 bit float.
| |||||||||||
Converts a 32 bit float to an 8 bit float.
| |||||||||||
floatToByte(b, mantissaBits=3, zeroExponent=15)
smallest non-zero value = 5.820766E-10 largest value = 7.5161928E9 epsilon = 0.125 | |||||||||||
floatToByte(b, mantissaBits=5, zeroExponent=2)
smallest nonzero value = 0.033203125 largest value = 1984.0 epsilon = 0.03125 |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
byteToFloat(b, mantissaBits=3, zeroExponent=15)
byteToFloat(b, mantissaBits=5, zeroExponent=2)
Converts an 8 bit float to a 32 bit float.
Converts a 32 bit float to an 8 bit float.
Values less than zero are all mapped to zero.
Values are truncated (rounded down) to the nearest 8 bit value.
Values between zero and the smallest representable value
are rounded up.
f | the 32 bit float to be converted to an 8 bit float (byte) |
---|---|
numMantissaBits | the number of mantissa bits to use in the byte, with the remainder to be used in the exponent |
zeroExp | the zero-point in the range of exponent values |
floatToByte(b, mantissaBits=3, zeroExponent=15)
smallest non-zero value = 5.820766E-10
largest value = 7.5161928E9
epsilon = 0.125
floatToByte(b, mantissaBits=5, zeroExponent=2)
smallest nonzero value = 0.033203125
largest value = 1984.0
epsilon = 0.03125