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.

Namespace: Lucene.Net.Util
Assembly: Lucene.Net (in Lucene.Net.dll) Version: 2.9.4.1

Syntax

C#
public static sbyte FloatToByte(
	float f,
	int numMantissaBits,
	int zeroExp
)
Visual Basic
Public Shared Function FloatToByte ( _
	f As Single, _
	numMantissaBits As Integer, _
	zeroExp As Integer _
) As SByte
Visual C++
public:
static signed char FloatToByte(
	float f, 
	int numMantissaBits, 
	int zeroExp
)

Parameters

f
Type: System..::..Single
the 32 bit float to be converted to an 8 bit float (byte)
numMantissaBits
Type: System..::..Int32
the number of mantissa bits to use in the byte, with the remainder to be used in the exponent
zeroExp
Type: System..::..Int32
the zero-point in the range of exponent values

Return Value

the 8 bit float representation

See Also