-
#include "tensorstore/util/bfloat16.h"
- class tensorstore::BFloat16;
Storage-only bfloat16 type.
https://en.wikipedia.org/wiki/Bfloat16_floating-point_format
This differs from
Eigen::bfloat16
andtensorflow::bfloat16
in that it preserves subnormals rather than flushing them to zero, and also preserves signaling NaN.Constructors¶
- constexpr BFloat16();
Zero initialization.
Conversion operators¶
- operator float() const;
Lossless conversion to
float
.
Assignment operators¶
Arithmetic operators¶
- friend BFloat16 operator++(BFloat16& a);
Pre-increment.
- friend BFloat16 operator--(BFloat16& a);
Pre-decrement.
- friend BFloat16 operator++(BFloat16& a, int);
Post-increment.
- friend BFloat16 operator--(BFloat16& a, int);
Post-decrement.
Classification functions¶
Floating-point manipulation functions¶
- BFloat16 tensorstore::nextafter(BFloat16 from, BFloat16 to);
Next representable value towards the given value.
Basic operations¶
- BFloat16 tensorstore::fmod(BFloat16 x, BFloat16 y);
Computes the floating-point remainder of the division operation
x / y
.
- Int4Padded tensorstore::abs(Int4Padded x);
Returns the absolute value of
x
.
Exponential functions¶
- BFloat16 tensorstore::log1p(BFloat16 x);
Computes the natural (base
) logarithm of 1 plus the given number ( ).
Power functions¶
Trigonometric functions¶
Hyperbolic functions¶
Rounding functions¶
- BFloat16 tensorstore::floor(BFloat16 x);
Computes the nearest integer not less than the given value.
- BFloat16 tensorstore::trunc(BFloat16 x);
Computes the nearest integer not greater in absolute value.
- BFloat16 tensorstore::rint(BFloat16 x);
Computes the nearest integer using the current rounding mode.