bfloat16

The APIs described in this section are reserved and may be changed or deprecated in the future. They do not need your attention.

Table 1 API list

API

Description

from_bits()

Indicates an empty struct, which is not used currently.

from_bits_t()

Indicates an empty struct, which is not used currently.

bfloat16(uint16_t bits, [[maybe_unused]] from_bits_t fromBits)

Indicates the constructor of struct bfloat16.

bfloat16()

bfloat16(float v)

bfloat16(const complex64 &val)

bfloat16(const complex128 &val)

bfloat16(const T &val)

float()

Converts the value of the struct bfloat16 member variable from the uint16_t type to the float type.

bool()

Checks whether the absolute value of bfloat16 is greater than the epsilon value of the float type.

epsilon()

Returns the epsilon value of the bfloat16 type.

short()

Converts the current bfloat16 value to the short type.

int()

Converts the current bfloat16 value to the int type.

long()

Converts the current bfloat16 value to the long type.

char()

Converts the current bfloat16 value to the char type.

double()

Converts the current bfloat16 value to the double type.

complex64()

Converts the current bfloat16 value to the complex64 type.

complex128()

Converts the current bfloat16 value to the complex128 type.

round_to_bfloat16(float v)

Converts a floating point number to bfloat16 using the round-nearest-to-even method.

highest()

Returns the maximum value of the bfloat16 type.

lowest()

Returns the minimum value of the bfloat16 type.

min_positive_normal()

Returns the minimum positive normal number of the bfloat16 type.

IsZero()

Checks whether the current bfloat16 value is 0.

float_isnan(const float &x)

Checks whether the value x of the float type is not a normal number.

isinf(const bfloat16 &a)

Checks whether the given bfloat16 value a is infinite.

isnan(const bfloat16 &a)

Checks whether the given bfloat16 value a is not a number.

isfinite(const bfloat16 &a)

Checks whether the given bfloat16 value a is finite.

exp(const bfloat16 &a)

Returns the ath power of e.

log(const bfloat16 &a)

Returns the natural logarithm of a.

log10(const bfloat16 &a)

Returns the logarithm of a to base 10.

sqrt(const bfloat16 &a)

Returns the square root of a.

pow(const bfloat16 &a, const bfloat16 &b)

Returns the bth power of a.

sin(const bfloat16 &a)

Returns the sine of angle a.

cos(const bfloat16 &a)

Returns the cosine of angle a.

tan(const bfloat16 &a)

Returns the tangent of angle a.

tanh(const bfloat16 &a)

Returns the hyperbolic tangent of angle a.

floor(const bfloat16 &a)

Returns the largest integer that is not greater than the value a of bfloat16.

ceil(const bfloat16 &a)

Returns the smallest integer that is not less than the value a of bfloat16.

min()

Returns the minimum positive normal number of the bfloat16 type.

max()

Returns the maximum value of the bfloat16 type.

round_error()

Returns the maximum rounding error.

infinity()

Returns an infinite value of the bfloat16 type.

quiet_NaN()

Returns a quiet (non-signaling) NaN value of the bfloat16 type.

signaling_NaN()

Returns the signaling NaN value of the bfloat16 type.

denorm_min()

Returns the minimum positive denormalized number of the bfloat16 type.