-
#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::expm1(BFloat16 x);
Computes \(e\) raised to the given power, minus 1 (\(e^x-1\)).
- BFloat16 tensorstore::log1p(BFloat16 x);
Computes the natural (base \(e\)) logarithm of 1 plus the given number (\(\ln (1 + x)\)).
- BFloat16 tensorstore::log10(BFloat16 x);
Computes the base-10 logarithm of the given number (\(\log_{10} x\)).
- BFloat16 tensorstore::log2(BFloat16 x);
Computes the base-2 logarithm of the given number (\(\log_2 x\)).
Power functions¶
- BFloat16 tensorstore::sqrt(BFloat16 x);
Computes the square root of the given number (\(\sqrt{x}\)).
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.