Parma Polyhedra Library requirements
C++ type-selected native inexact-flag helpers

C++ type-selected native inexact-flag helpers

UID:
VERSION:
CLASSIFICATION:
PREFIX:
Type
Level
MID
UID
REFS
Title
Statement
Rationale
Comment
BIBLIOGRAPHY
STATUS
COMPONENT
APPLICABILITY
VERIFICATION_METHODS
VERIFICATION_CRITERIA
SOURCE
LANGUAGE
VISIBILITY
INTERFACE
SW_SPEC
1
PPL-SPEC-000917
PPL-SPEC-000917
Floating-related traits and conditional inexact state access

FPU_Related<T>::value shall be a compile-time Boolean constant that is true for exactly the unqualified native types float, double and long double, and false for other primary-template types. A supported Checked_Number<T, Policy> specialization shall forward the underlying FPU_Related<T>::value independently of the policy. Native type classification shall not depend on whether PPL rounded floating operations were enabled in the build. In particular, cv-qualified raw floating types shall retain the primary-template result.

When FPU_Related<T>::value is false, maybe_reset_fpu_inexact<T>() shall do nothing and maybe_check_fpu_inexact<T>() shall return zero. Neither call shall access the native FPU backend or alter rounding direction, exception flags or other numerical state, even if an unrelated floating operation has set an inexact flag.

When that value is true, the reset helper shall call fpu_reset_inexact() and the query helper shall return exactly the result of fpu_check_inexact(). A supported flag query shall report zero when clear and one when set, without clearing it; a backend without inexact-flag observation shall retain its negative unavailable result. Exception flags and rounding-control effects shall be those of the corresponding native backend functions. These related-type calls shall satisfy the backend setup and state-ownership conditions of 🔗 4. Rounding-state exchange during an initialized thread lifetime, including the default upward entry direction required by an IA32 reset backend. If the configured backend cannot control the FPU, a related-type call shall propagate its std::logic_error rather than treat the type as unrelated.

No scalar instance, checked rounding default or policy handler shall be required or consulted. Type constants and unrelated-type calls shall require no library initialization, coefficient-constant stage or FPU setup. Related-type calls shall add no setup obligation beyond the selected native backend.

Type-directed generic arithmetic can avoid touching floating state for unrelated storage while preserving the native backend protocol for floating storage, including unavailable-backend behavior.

APPROVED
NUMERICS
IF_CPP
Test, Analysis, Inspection

Check trait values for every scalar family, checked policies and cv-qualified raw types. Independently seed/query standard inexact flags, require pure unrelated-type behavior and exact reset/query forwarding with admitted backend setup, and check repeated queries do not clear the flag. Cover the actual disabled-FPU configuration and unavailable-observation branch where provided. Require exact function return types, no policy/default dependency and unchanged type constants across configurations.

src/checked_ext_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; tests/numericinexactselectionspec1.cc.

CPP
Public

Public header: <ppl.hh>; templates in Parma_Polyhedra_Library:

template <typename T>
struct FPU_Related;

template <typename T, typename Policy>
struct FPU_Related<Checked_Number<T, Policy>>;

template <typename T>
void maybe_reset_fpu_inexact();

template <typename T>
int maybe_check_fpu_inexact();