ftz 0.0.1
Fast, reproducible floating-point arithmetic
Loading...
Searching...
No Matches
ftz::basic_ftz32< Hardware > Struct Template Referenceexport

Binary32 value with a compile-time signed-FTZ policy. More...

Public Member Functions

constexpr basic_ftz32 () noexcept=default
 Constructs positive zero.
constexpr basic_ftz32 (float value) noexcept
 Imports a float, replacing subnormal magnitude with signed zero.
constexpr operator float () const noexcept
 Exports unchanged bits as float; subsequent ordinary arithmetic is outside this contract.
constexpr float to_float () const noexcept
 Exports the stored binary32 representation as float without arithmetic.
constexpr unsigned int to_bits () const noexcept
 Exports the exact stored word, including zero sign and NaN payload.
constexpr basic_ftz32 & operator+= (basic_ftz32 b) noexcept
 Assigns the corresponding FTZ result and returns this value by reference.
constexpr basic_ftz32 & operator-= (basic_ftz32 b) noexcept
 Assigns the corresponding FTZ result and returns this value by reference.
constexpr basic_ftz32 & operator*= (basic_ftz32 b) noexcept
 Assigns the corresponding FTZ result and returns this value by reference.
constexpr basic_ftz32 & operator/= (basic_ftz32 b) noexcept
 Assigns the corresponding FTZ result and returns this value by reference.

Static Public Member Functions

static constexpr basic_ftz32 from_float (float value) noexcept
 Imports and normalizes a float, as the converting constructor does.
static constexpr basic_ftz32 unsafe_from_float32 (float value) noexcept
 Wraps float bits without classification or normalization.
static constexpr basic_ftz32 from_bits (unsigned int bits) noexcept
 Imports binary32 bits, flushing only subnormal magnitudes to signed zero.

Friends

constexpr basic_ftz32 operator+ (basic_ftz32 a, basic_ftz32 b) noexcept
 Applies the FTZ arithmetic/sign operation, preserving this policy and signed-zero semantics.
constexpr basic_ftz32 operator- (basic_ftz32 a, basic_ftz32 b) noexcept
 Applies the FTZ arithmetic/sign operation, preserving this policy and signed-zero semantics.
constexpr basic_ftz32 operator* (basic_ftz32 a, basic_ftz32 b) noexcept
 Applies the FTZ arithmetic/sign operation, preserving this policy and signed-zero semantics.
constexpr basic_ftz32 operator/ (basic_ftz32 a, basic_ftz32 b) noexcept
 Divides using the reproducible reciprocal-refinement graph, with signed IEEE-like zero/infinity cases.
constexpr basic_ftz32 operator- (basic_ftz32 a) noexcept
 Flips only the sign bit, preserving signed zero and NaN payloads.
constexpr basic_ftz32 operator+ (basic_ftz32 a) noexcept
 Returns the value unchanged.
constexpr bool operator== (basic_ftz32 a, basic_ftz32 b) noexcept
 Compares values; NaN is unordered (only != is true), and the two zero signs compare equal.
constexpr bool operator!= (basic_ftz32 a, basic_ftz32 b) noexcept
 Compares values; NaN is unordered (only != is true), and the two zero signs compare equal.
constexpr bool operator< (basic_ftz32 a, basic_ftz32 b) noexcept
 Compares values; NaN is unordered (only != is true), and the two zero signs compare equal.
constexpr bool operator> (basic_ftz32 a, basic_ftz32 b) noexcept
 Compares values; NaN is unordered (only != is true), and the two zero signs compare equal.
constexpr bool operator<= (basic_ftz32 a, basic_ftz32 b) noexcept
 Compares values; NaN is unordered (only != is true), and the two zero signs compare equal.
constexpr bool operator>= (basic_ftz32 a, basic_ftz32 b) noexcept
 Compares values; NaN is unordered (only != is true), and the two zero signs compare equal.

Detailed Description

template<bool Hardware>
struct ftz::basic_ftz32< Hardware >

Binary32 value with a compile-time signed-FTZ policy.

Template Parameters
Hardwarefalse selects explicit normalization, true admitted hardware FTZ. Default construction yields positive zero. Public imports normalize subnormals to signed zero even for hardware policy; unsafe imports transfer that obligation to the caller. Conversion to float preserves bits but leaves the type contract. Opposite-policy arithmetic is rejected; explicitly choose a policy at the boundary.

Definition at line 64 of file ftz.ccm.

Member Function Documentation

◆ unsafe_from_float32()

template<bool Hardware>
constexpr basic_ftz32 ftz::basic_ftz32< Hardware >::unsafe_from_float32 ( float value)
inlinestaticnodiscardconstexprnoexcept

Wraps float bits without classification or normalization.

Precondition
value is normal, signed zero, infinity or NaN; no subnormal is allowed.

Definition at line 78 of file ftz.ccm.


The documentation for this struct was generated from the following file: