Definition of a 16-bit float type.
More...
#include <DataType.h>
|
| Float16 ()=default |
| Default constructor.
|
|
| Float16 (const uint16_t sign, const uint16_t fraction, const uint16_t exponent) |
| Creates a new 16-bit float.
|
|
| Float16 (const uint16_t binary) |
| Creates a new 16-bit float based on a 16-bit binary value.
|
|
uint16_t | binary () const |
| Returns the binary representation of this 16-bit float value.
|
|
| operator float () const |
| Cast operator to 32-bit float.
|
|
Float16 | operator- () const |
| Negates the 16-bit float value.
|
|
bool | operator== (const Float16 &second) const |
| Returns whether two 16-bit float values are identical.
|
|
bool | operator!= (const Float16 &second) const |
| Returns whether two 16-bit float values are not identical.
|
|
|
union { | |
|
uint16_t binary_ = 0u | |
| The binary representation. More...
|
|
struct { | |
|
uint16_t fraction_: 10 | |
| The mantissa composed of 10 bits. More...
|
|
uint16_t exponent_: 5 | |
| The exponent composed of 5 bits. More...
|
|
uint16_t sign_: 1 | |
| The sign composed of 1 bit. More...
|
|
} ieee_ | |
| The struct with the IEEE representation. More...
|
|
} | data_ | |
| Union allowing to access the binary representation or the IEEE representation.
|
|
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]
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]
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: