Parma Polyhedra Library requirements
C++ native floating-point classification and special values
1. Native floating-point NaN and infinity predicates PPL-SPEC-000321

The admitted storage type F shall be a configured supported native float, double or long double as in 🔗 1. Supported exact integer and rational conversion to native floating storage. T shall be F itself or Checked_Number<F, P>, where P is Check_Overflow_Policy<F>, Checked_Number_Transparent_Policy<F> or Extended_Number_Policy. A source shall contain a finite value, either infinity or a quiet NaN of that native format.

is_not_a_number(x) shall be true exactly for a NaN. is_minus_infinity(x) shall be true exactly for negative infinity, and is_plus_infinity(x) exactly for positive infinity. infinity_sign(x) shall return  − 1 for negative infinity, 1 for positive infinity and zero otherwise, including for a NaN and either signed zero. These queries shall not interpret a finite endpoint or a subnormal as an infinity.

The source shall be live and shall remain unchanged, including its zero sign. Concurrent access shall be prevented while another operation modifies it. No library initialization object, thread initialization or coefficient constant stage shall be required. Floating-point exceptions shall be nontrapping. Calls shall require no particular hardware rounding direction and shall preserve that direction. Floating-point exception-status flags shall be unspecified. Unavailable native source formats shall not be instantiated.

2. Selective classification of native floating-point checked values PPL-SPEC-000322

For Checked_Number<F, P> with the storage types, policies and source values in 🔗 1. Native floating-point NaN and infinity predicates, classify(nan, inf, sign) shall return the following Result, applying these rules in order:

  • For a NaN, if nan or sign is true, it shall return V_NAN.
  • If inf is true, a negative infinity shall return V_EQ_MINUS_INFINITY and a positive infinity V_EQ_PLUS_INFINITY.
  • If sign is true, a negative value shall return V_LT, a positive value V_GT and either signed zero V_EQ. This rule shall include infinities whose infinity classification was not requested.
  • Otherwise it shall return lazy V_LGE. This shall include a NaN when neither NaN nor sign classification was requested.

The same requested-field rules shall apply to a custom policy providing the selected classification capabilities. A source shall not contain NaN when its policy has has_nan == false, nor infinity when it has has_infinity == false. Finite-only custom policies shall therefore admit every request mask on their valid finite sources.

Omitting arguments shall request all three classifications. A normal V_LT or V_GT shall characterize the value's sign relative to zero; it shall not describe an arithmetic rounding error. The class and relation fields shall have the meanings in 🔗 1. Numerical result classes and relation meanings. Source validity, availability, synchronization, initialization independence and floating-point state conditions shall follow 🔗 1. Native floating-point NaN and infinity predicates.

PPL-SPEC-000323
3. Native floating-point extended integrality and quiet-NaN rejection PPL-SPEC-000323

For an admitted raw or checked source type in 🔗 1. Native floating-point NaN and infinity predicates, is_integer(x) shall return true exactly when the source's represented binary value is a finite integer or an admitted signed infinity. It shall return false for a quiet NaN. Either signed zero shall be integral. This is membership in the extended integral domain ℤ∪{ − ∞,  + ∞}; infinity shall not thereby be identified with a member of ℤ. A caller requiring ordinary integer membership shall additionally exclude both infinities. Every finite representable value with zero fractional part shall be integral even when its magnitude exceeds every configured bounded coefficient range.

The result shall not depend on the current hardware rounding direction. Source validity, availability, preservation, synchronization, initialization independence and floating-point state conditions shall follow 🔗 1. Native floating-point NaN and infinity predicates.

4. Typed special-value assignment to native floating-point storage PPL-SPEC-000324

For a live assignable destination of an admitted raw or checked type in 🔗 1. Native floating-point NaN and infinity predicates, assign_r from Minus_Infinity shall store negative infinity and return V_EQ_MINUS_INFINITY. Assignment from Plus_Infinity shall store positive infinity and return V_EQ_PLUS_INFINITY. Assignment from Not_A_Number shall store a quiet NaN and return V_NAN. These results shall be representable and shall not carry V_UNREPRESENTABLE. The supplied marker shall remain unchanged.

Infinity markers shall admit all four base directions in 🔗 4. Rounding-direction intent, composition and inspection, with or without ROUND_STRICT_RELATION. A NaN marker shall admit ROUND_DOWN, ROUND_UP and ROUND_IGNORE, with or without the strict flag. It shall not require an ordered NaN relation: V_NAN shall retain its empty relation. The _r interface shall return the result without policy-handler dispatch.

Callers shall prevent concurrent destination access while another operation modifies it. Configured-format availability, initialization independence and floating-point state conditions shall follow 🔗 1. Native floating-point NaN and infinity predicates. The value supplied on entry in the destination shall impose no numerical precondition on the replacement. The stored NaN's payload and sign shall be unspecified.