#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 and tensorflow::bfloat16 in that it preserves subnormals rather than flushing them to zero, and also preserves signaling NaN.

Constructors

constexpr BFloat16();

Zero initialization.

explicit BFloat16(T x);

Possibly lossy conversion from any type convertible to float.

Conversion operators

operator float() const;

Lossless conversion to float.

Assignment operators

BFloat16operator=(float v);

Possibly lossy conversion from float.

BFloat16operator=(bool v);

Bool assignment.

BFloat16operator=(T v);

Possibly lossy conversion from any integer type.

Arithmetic operators

friend BFloat16 operator+(BFloat16 aBFloat16 b);

Addition operator.

friend BFloat16operator+=(BFloat16aBFloat16 b);

Addition assignment operator.

friend BFloat16 operator-(BFloat16 aBFloat16 b);

Subtraction operator.

friend BFloat16operator-=(BFloat16aBFloat16 b);

Subtraction assignment operator.

friend BFloat16 operator*(BFloat16 aBFloat16 b);

Multiplication operator.

friend BFloat16operator*=(BFloat16aBFloat16 b);

Multiplication assignment operator.

friend BFloat16 operator/(BFloat16 aBFloat16 b);

Division operator.

friend BFloat16operator/=(BFloat16aBFloat16 b);

Division assignment operator.

friend BFloat16 operator-(BFloat16 a);

Unary negation.

friend BFloat16 operator+(BFloat16 a);

Unary plus.

friend BFloat16 operator++(BFloat16a);

Pre-increment.

friend BFloat16 operator--(BFloat16a);

Pre-decrement.

friend BFloat16 operator++(BFloat16aint);

Post-increment.

friend BFloat16 operator--(BFloat16aint);

Post-decrement.

Classification functions

bool tensorstore::isinf(BFloat16 x);

Returns true if x is +/-infinity.

bool tensorstore::isnan(BFloat16 x);

Returns true if x is NaN.

bool tensorstore::isfinite(BFloat16 x);

Returns true if x is finite.

Floating-point manipulation functions

bool tensorstore::signbit(BFloat16 x);

Returns true if x is negative.

BFloat16 tensorstore::nextafter(BFloat16 fromBFloat16 to);

Next representable value towards the given value.

Basic operations

BFloat16 tensorstore::abs(BFloat16 x);

Returns the absolute value of x.

BFloat16 tensorstore::fmod(BFloat16 xBFloat16 y);

Computes the floating-point remainder of the division operation x / y.

BFloat16 tensorstore::fmin(BFloat16 aBFloat16 b);

Computes the minimum of two values.

BFloat16 tensorstore::fmax(BFloat16 aBFloat16 b);

Computes the maximum of two values.

Int4Padded tensorstore::abs(Int4Padded x);

Returns the absolute value of x.

Exponential functions

BFloat16 tensorstore::exp(BFloat16 x);

Computes \(e\) raised to the given power (\(e^x\)).

BFloat16 tensorstore::exp2(BFloat16 x);

Computes \(2\) raised to the given power (\(2^x\)).

BFloat16 tensorstore::expm1(BFloat16 x);

Computes \(e\) raised to the given power, minus 1 (\(e^x-1\)).

BFloat16 tensorstore::log(BFloat16 x);

Computes the natural (base \(e\)) logarithm (\(\ln x\))

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}\)).

BFloat16 tensorstore::pow(BFloat16 xBFloat16 y);

Raises a number to the given power (\(x^y\)).

Trigonometric functions

BFloat16 tensorstore::sin(BFloat16 x);

Computes the sine of the given number (\(\sin x\)).

BFloat16 tensorstore::cos(BFloat16 x);

Computes the cosine of the given number (\(cos x\)).

BFloat16 tensorstore::tan(BFloat16 x);

Computes the tangent.

BFloat16 tensorstore::asin(BFloat16 x);

Computes the inverse sine.

BFloat16 tensorstore::acos(BFloat16 x);

Computes the inverse cosine.

BFloat16 tensorstore::atan(BFloat16 x);

Computes the inverse tangent.

Hyperbolic functions

BFloat16 tensorstore::sinh(BFloat16 x);

Computes the hyperbolic sine.

BFloat16 tensorstore::cosh(BFloat16 x);

Computes the hyperbolic cosine.

BFloat16 tensorstore::tanh(BFloat16 x);

Computes the hyperbolic tangent.

BFloat16 tensorstore::asinh(BFloat16 x);

Computes the inverse hyperbolic sine.

BFloat16 tensorstore::acosh(BFloat16 x);

Computes the inverse hyperbolic cosine.

BFloat16 tensorstore::atanh(BFloat16 x);

Computes the inverse hyperbolic tangent.

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.

BFloat16 tensorstore::ceil(BFloat16 x);

Computes the nearest integer not less than the given value.