Definition of a 16-bit float type.
More...
Definition of a 16-bit float type.
◆ Float16() [1/3]
Ocean::Float16::Float16 |
( |
| ) |
|
|
default |
◆ Float16() [2/3]
Ocean::Float16::Float16 |
( |
const uint16_t |
sign, |
|
|
const uint16_t |
fraction, |
|
|
const uint16_t |
exponent |
|
) |
| |
|
inline |
Creates a new 16-bit float.
- Parameters
-
sign | The 1-bit sign to be used, with range [0, 1] |
fraction | The 10-bit fraction to be used, with range [0, 1023] |
exponent | The 5-bit exponent to be used, with range [0, 31] |
◆ Float16() [3/3]
Ocean::Float16::Float16 |
( |
const uint16_t |
binary | ) |
|
|
inlineexplicit |
Creates a new 16-bit float based on a 16-bit binary value.
- Parameters
-
binary | The binary value to be used |
◆ binary()
uint16_t Ocean::Float16::binary |
( |
| ) |
const |
|
inline |
Returns the binary representation of this 16-bit float value.
- Returns
- The value's binary representation
◆ infinity()
Float16 Ocean::Float16::infinity |
( |
| ) |
|
|
inlinestatic |
Returns +infinity.
- Returns
- The 16-bit float representing positive infinity
◆ operator float()
Ocean::Float16::operator float |
( |
| ) |
const |
|
explicit |
Cast operator to 32-bit float.
- Returns
- The 32-bit float representation
◆ operator!=()
bool Ocean::Float16::operator!= |
( |
const Float16 & |
second | ) |
const |
|
inline |
Returns whether two 16-bit float values are not identical.
- Parameters
-
second | The second value to compare |
- Returns
- True, if so
◆ operator-()
Float16 Ocean::Float16::operator- |
( |
| ) |
const |
|
inline |
Negates the 16-bit float value.
- Returns
- The negated value
◆ operator==()
bool Ocean::Float16::operator== |
( |
const Float16 & |
second | ) |
const |
|
inline |
Returns whether two 16-bit float values are identical.
- Parameters
-
second | The second value to compare |
- Returns
- True, if so
◆ binary_
uint16_t Ocean::Float16::binary_ = 0u |
The binary representation.
union { ... } Ocean::Float16::data_ |
Union allowing to access the binary representation or the IEEE representation.
◆ exponent_
uint16_t Ocean::Float16::exponent_ |
The exponent composed of 5 bits.
◆ fraction_
uint16_t Ocean::Float16::fraction_ |
The mantissa composed of 10 bits.
struct { ... } Ocean::Float16::ieee_ |
The struct with the IEEE representation.
◆ sign_
uint16_t Ocean::Float16::sign_ |
The sign composed of 1 bit.
The documentation for this class was generated from the following file: