Types

Portable IEEE 754 binary16 half-precision type (real_fp16_t in Type/real_fp16_t.hpp) usable with or without CUDA.

class real_fp16_t global · Type/real_fp16_t.hpp · 10 members

Portable IEEE 754 binary16 (FP16) scalar type with constexpr conversion, round-to-nearest-even, vectorized array helpers, math overloads, and _fp16 literals.

real_fp16_t() = default;
REAL_FP16_CONSTEXPR real_fp16_t(float v) noexcept; Converts float to binary16 using round-to-nearest-even.
REAL_FP16_CONSTEXPR real_fp16_t(double v) noexcept; Single-rounding conversion from double to binary16.
static constexpr real_fp16_t from_bits(std::uint16_t b) noexcept;
constexpr std::uint16_t bits() const noexcept;
REAL_FP16_CONSTEXPR float to_float() const noexcept;
constexpr bool is_nan() const noexcept / is_inf() / is_finite() / is_zero() / is_subnormal() / is_normal(); IEEE 754 classification predicates.
static constexpr real_fp16_t max() noexcept // 65504, min() // 2^-14, epsilon() // 2^-10;
static void to_float_array(const real_fp16_t* src, float* dst, std::size_t n) noexcept;
static void from_float_array(const float* src, real_fp16_t* dst, std::size_t n) noexcept;
Free functions & typedefs1
REAL_FP16_CONSTEXPR real_fp16_t operator""_fp16(long double v) noexcept; User-defined FP16 literal.