bfloat16_t#
-
struct bfloat16_t#
Class that provides a type that implements half precision floating point using the bfloat16 format.
This type is enforced to be 16-bits wide and maintains no state other than the raw bits so that it can passed to code that checks a type’s size and used for halide_buffer_t allocation.
Constructors
-
explicit bfloat16_t(float value)#
Construct from a float, double, or int using round-to-nearest-ties-to-even.
Out-of-range values become +/- infinity.
-
explicit bfloat16_t(double value)#
Construct from a float, double, or int using round-to-nearest-ties-to-even.
Out-of-range values become +/- infinity.
-
explicit bfloat16_t(int value)#
Construct from a float, double, or int using round-to-nearest-ties-to-even.
Out-of-range values become +/- infinity.
-
explicit bfloat16_t(int64_t value)#
Construct from a float, double, or int using round-to-nearest-ties-to-even.
Out-of-range values become +/- infinity.
-
explicit bfloat16_t(uint64_t value)#
Construct from a float, double, or int using round-to-nearest-ties-to-even.
Out-of-range values become +/- infinity.
-
bfloat16_t() = default#
Construct a bfloat16_t with the bits initialised to 0.
This represents positive zero.
Public Functions
-
explicit operator float() const#
Cast to float.
-
explicit operator double() const#
Cast to double.
-
explicit operator int() const#
Cast to int.
-
bfloat16_t operator-() const#
Return a new bfloat16_t with a negated sign bit.
-
bfloat16_t operator+(bfloat16_t rhs) const#
Arithmetic operators.
-
bool operator==(bfloat16_t rhs) const#
Comparison operators.
-
bool is_nan() const#
Properties.
-
uint16_t to_bits() const#
Returns the bits that represent this bfloat16_t.
An alternative method to access the bits is to cast a pointer to this instance as a pointer to a uint16_t.
Public Static Functions
-
static bfloat16_t make_zero()#
Get a new bfloat16_t that represents a special value.
-
static bfloat16_t make_from_bits(uint16_t bits)#
Get a new bfloat16_t with the given raw bits.
- Parameters:
bits – The bits conformant to IEEE754 binary16
-
explicit bfloat16_t(float value)#