muu/half.h file

Contains the definition of muu::half.

Namespaces

namespace muu
The root namespace for all muu functions and types.
namespace muu::build
Build environment information (compiler, date/time, support for various things...)
namespace muu::literals inline
Literal operators.

Classes

struct muu::half
A 16-bit "half-precision" IEEE754 floating point type.
template <>
struct muu::constants<half>
16-bit half-precision float constants.
template <>
struct std::numeric_limits<muu::half>
Specialization of std::numeric_limits for muu::half.

Functions

auto abs(half x) -> half constexpr noexcept
Returns the absolute value of a half-precision float.
auto acos(half x) -> half constexpr noexcept
Returns the arc cosine of a half-precision float.
auto approx_equal(half a, half b, half epsilon = constants<half>::default_epsilon) -> bool constexpr noexcept
Returns true if two half-precision floats are approximately equal.
auto approx_zero(half x, half epsilon = constants<half>::default_epsilon) -> bool constexpr noexcept
Returns true a half-precision float is approximately equal to zero.
auto asin(half x) -> half constexpr noexcept
Returns the arc sine of a half-precision float.
auto atan(half x) -> half constexpr noexcept
Returns the arc tangent of a half-precision float.
auto atan2(half y, half x) -> half constexpr noexcept
Returns the arc tangent of a half-precision float.
auto ceil(half x) -> half constexpr noexcept
Returns the ceiling of a half-precision float.
auto consteval_sqrt(half x) -> half constexpr noexcept
Returns the square-root of a half-precision float.
auto cos(half x) -> half constexpr noexcept
Returns the cosine of a half-precision float.
auto floor(half x) -> half constexpr noexcept
Returns the floor of a half-precision float.
auto infinity_or_nan(half x) -> bool constexpr noexcept
Returns true if a half-precision float is infinity or NaN.
auto lerp(half start, half finish, half alpha) -> half constexpr noexcept
Returns a linear interpolation between two half-precision floats.
auto normalize_angle(half x) -> half constexpr noexcept
Normalizes the angle value of a half-precision float.
auto normalize_angle_signed(half x) -> half constexpr noexcept
Normalizes the angle value of a half-precision float.
auto operator""_f16(long double val) -> half consteval noexcept
Literal for creating a half-precision float.
auto operator""_f16(unsigned long long val) -> half consteval noexcept
Literal for creating a half-precision float.
auto sin(half x) -> half constexpr noexcept
Returns the sine of a half-precision float.
auto sqrt(half x) -> half constexpr noexcept
Returns the square-root of a half-precision float.
auto tan(half x) -> half constexpr noexcept
Returns the tangent of a half-precision float.

Variables

bool supports_constexpr_half constexpr
True if using muu::half in constexpr contexts is fully supported on this compiler.