Documentation
¶
Overview ¶
Package float16 implements the IEEE 754 half-precision floating-point format (binary16).
Index ¶
Constants ¶
const SmallestNonzero = Float16(0x0001)
SmallestNonzero is the smallest nonzero denormal value for float16. For IEEE 754 binary16, the smallest non-zero denormalized value is 2^-24, which is approximately 5.96e-8.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Float16 ¶
type Float16 uint16
Float16 (half-precision floating-point) format is a computer number format occupying 16 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point. This format is the IEEE 754 half-precision floating-point format (binary16).
func From ¶
func From[T numberTypes](value T) Float16
From converts the value from a standard numeric type to Float16.
func FromFloat32s ¶
FromFloat32s converts a variadic list of float32s to a []Float16.
func FromNumbers ¶
func FromNumbers[T numberTypes](values ...T) []Float16
FromNumbers converts a variadic list of numeric values to a []Float16.
func Inf ¶
Inf returns a Float16 with an infinity value with the specified sign. A sign >= returns positive infinity. A sign < 0 returns negative infinity.
func (*Float16) SetFloat32 ¶
SetFloat32 sets the values from a float32.
func (*Float16) SetFloat64 ¶
SetFloat64 sets the values from a float64.