ftz 0.0.1
Fast, reproducible floating-point arithmetic
Loading...
Searching...
No Matches
FTZ values and conversions

Concepts

concept  ftz::ftz32_type
 Accepts either scalar policy after removing cv/ref qualifiers.

Classes

struct  ftz::basic_ftz32< Hardware >
 Binary32 value with a compile-time signed-FTZ policy. More...

Typedefs

using ftz::m32 = basic_ftz32<false>
 Explicit-normalization value; arithmetic supports gradual and admitted flush regions.
using ftz::h32 = basic_ftz32<true>
 Hardware-normalization value; arithmetic requires a qualified flush region.
using ftz::ftz32 = basic_ftz32<FTZ_FP32_HARDWARE_FTZ != 0>
 Compatibility alias selected by the installed FTZ_FP32_HARDWARE_FTZ package setting. Both m32 and h32 remain available; do not override this package setting per translation unit.

Variables

template<class T>
constexpr bool ftz::is_ftz32 = false
 Identifies the two unqualified FTZ scalar types. Use ftz32_type to ignore cv/ref.

Detailed Description

Four-byte binary32 values without subnormals. Normal values, signed zero, infinities and NaNs are representable; arithmetic does not promise NaN bits. Operators and FTZ math reject expressions that contain both m32 and h32, including scalar/vector/wide arithmetic, comparisons, fma and selection. Choose a policy explicitly at that boundary. Converting operands to ordinary float, using the conditional operator or asking std::common_type can leave this FTZ overload set through the deliberately implicit float conversion.

using F = ftz::m32;
auto canonical_zero = F::from_bits(0x80000001u); // Negative subnormal -> -0.
auto known = F::unsafe_from_float32(1.5f); // Already canonical.
float ordinary = known; // Leaves the FTZ type contract.
auto hardware_value = ftz::h32::from_bits(known.to_bits()); // Explicit policy choice.