Container for a 16 bit float. More...
Public Member Functions | |
Half () noexcept | |
Constructor. | |
Half (float16_t uData) noexcept | |
Constructor with 16 bit float. | |
Half (float fInput) noexcept | |
Constructor with 32 bit float. | |
operator float () const noexcept | |
Convert to a 32 bit float. | |
operator uint16_t () const noexcept | |
Return the 16 bit float. | |
uint_t | is_finite () const noexcept |
Test if the value is finite. | |
uint_t | is_infinity () const noexcept |
Test if the value is infinite. | |
uint_t | is_nan () const noexcept |
Test if the value is NaN. | |
uint_t | is_normalized () const noexcept |
Test if the value is normalzed. | |
uint_t | is_denormalized () const noexcept |
Test if the value is denormalzed. | |
uint_t | is_zero () const noexcept |
Test if the value is zero. | |
uint_t | is_negative () const noexcept |
Test if the value is negative. | |
Half | operator- () const noexcept |
Return a negated Half. | |
Half & | operator= (const Half &rInput) noexcept |
Copy a Half class. | |
Half & | operator= (float fInput) noexcept |
Assign a 32 bit float to this class. | |
Half & | operator+= (const Half &rInput) noexcept |
Add a Half to this Half. | |
Half & | operator+= (float fInput) noexcept |
Add a float to this Half. | |
Half & | operator-= (const Half &rInput) noexcept |
Subtract a Half from this Half. | |
Half & | operator-= (float fInput) noexcept |
Subtract a float to this Half. | |
Half & | operator*= (const Half &rInput) noexcept |
Multiply a Half with this Half. | |
Half & | operator*= (float fInput) noexcept |
Multiply a float to this Half. | |
Half & | operator/= (const Half &rInput) noexcept |
Divide a Half from this Half. | |
Half & | operator/= (float fInput) noexcept |
Divide a float from this Half. | |
Private Attributes | |
float16_t | m_uData |
Binary representation of a 16 bit float. | |
Container for a 16 bit float.
This class will allow math functions to be applied to a 16 bit float since most "C" compilers don't have native support for the data type.
While this class exists, it is recommended to perform math operations with float or double until a final result is created and then the result is converted to the float16 data type.
|
inlinenoexcept |
Constructor.
This constructor does NOT initialize this class.
|
inlinenoexcept |
|
noexcept |
Constructor with 32 bit float.
Initialize with a 32 bit float, which is converted into a 16 bit float.
|
inlinenoexcept |
Test if the value is denormalzed.
If the contained value is denormalized, return TRUE
|
inlinenoexcept |
Test if the value is finite.
If the contained value is a finite value, return TRUE
|
inlinenoexcept |
Test if the value is infinite.
If the contained value is a infinite value, return TRUE
|
inlinenoexcept |
Test if the value is NaN.
If the contained value is a NaN (Not a Number) value, return TRUE
|
inlinenoexcept |
Test if the value is negative.
If the contained value has the sign bit set, return TRUE
|
inlinenoexcept |
Test if the value is normalzed.
If the contained value is normalized, return TRUE
|
inlinenoexcept |
Test if the value is zero.
If the contained value is zero, return TRUE
|
noexcept |
Convert to a 32 bit float.
Convert the float 16 into a 32 bit float and return the float.
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
Assign a 32 bit float to this class.
Convert the 32 bit float into a 16 bit float and store the 16 bit value in this instance of this class.
fInput | 32 bit float to convert to a 16 bit float. |
|
private |
Binary representation of a 16 bit float.