Beatmup
|
16 bit floating point representation. More...
#include <float16.h>
Public Member Functions | |
Float16 (float input) | |
Encodes a given floating point value in 16 bit. More... | |
Float16 (uint8_t frac, uint8_t exp) | |
Constructs a Float16 number from the fractional part and the exponent values given explicitly. More... | |
operator float () const | |
Converts the encoded value to a floating-point value. More... | |
uint8_t | getExp () const |
Returns encoded exponent. More... | |
uint8_t | getFrac () const |
Returns encoded fractional part. More... | |
Static Public Member Functions | |
static std::string | encodeGlsl (const std::string &name="encode") |
Returns a GLSL code defining the encoding function from a high precision floating point value into a low precision vec2. More... | |
static std::string | decodeGlsl (const std::string &name="decode") |
Returns a GLSL code defining the decoding function from a low precision vec2 to a high precision floating point value. More... | |
Private Attributes | |
uint8_t | frac |
fractional part More... | |
uint8_t | exp |
exponent part More... | |
16 bit floating point representation.
The exponent and the signed fractional part are encoded to 8 bits each. x = frac * 2 ^ exp
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |