-
1. Numerical and geometric foundations UID: PPL-HLR-000001 STATUS: APPROVED COMPONENT: LIBRARY_WIDE APPLICABILITY: ALL VERIFICATION_METHODS: Test, Analysis, Review RELATIONS (Child): - PPL-LLR-000446 Reloadable textual representations (Refined by)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Refined by)
- PPL-LLR-000012 Affine meaning of linear expressions (Refined by)
- PPL-LLR-000013 Meaning of linear constraints (Refined by)
- PPL-LLR-000014 Meaning of linear congruences (Refined by)
- PPL-LLR-000015 Distinct meanings of geometric generators (Refined by)
- PPL-LLR-000001 Exact integral coefficient calculations (Refined by)
- PPL-LLR-000002 Detection of checked coefficient overflow (Refined by)
- PPL-LLR-000003 Conservative directed numerical bounds (Refined by)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Refined by)
- PPL-LLR-000414 Integer quotient and remainder semantics (Refined by)
- PPL-LLR-000415 Exact rational arithmetic (Refined by)
STATEMENT: PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.
RATIONALE: Domains and solvers need a common interpretation of coefficients, coordinates, expressions, constraints and generators.
VERIFICATION_CRITERIA: Review the common mathematical definitions and their consistency across domains; exercise representative descriptor construction, arithmetic and dimension changes under each supported numerical configuration.
BIBLIOGRAPHY: BagnaraHZ08SCP | Whole work (background on the library's numerical abstractions and design).
SOURCE: doc/definitions.dox: Basic_Geometric_Descriptors, Syntactic_Geometric_Descriptors; src/Coefficient_defs.hh; src/Linear_Expression_defs.hh.
- PPL-SPEC-001629 Complete-tree cursor positions, topology and occupied-node search (Specified by)
- PPL-SPEC-000041 Configured integral coefficient type and return trait (Specified by)
- PPL-SPEC-000042 Finite coefficient construction, copying and comparison (Specified by)
- PPL-SPEC-000043 Exact ordinary integral coefficient arithmetic (Specified by)
- PPL-SPEC-000048 Coefficient scaling and truncated division by powers of two (Specified by)
- PPL-SPEC-000052 Coefficient negation and absolute-value assignment (Specified by)
- PPL-SPEC-000056 Integral product accumulation and subtraction (Specified by)
- PPL-SPEC-000425 Forward elimination and augmented equality/line rank (Specified by)
- PPL-SPEC-000426 Back substitution through a triangular nonconstant basis (Specified by)
- PPL-SPEC-000427 Simplification of equality and line subsystems (Specified by)
- PPL-SPEC-000428 Sorting rows together with their saturation records (Specified by)
- PPL-SPEC-000429 Adding processed rows for new coordinate axes (Specified by)
- PPL-SPEC-001649 Sparse equality and line pivot selection (Specified by)
- PPL-SPEC-000418 Row-wise normalization and certificate invalidation (Specified by)
- PPL-SPEC-000842 Native integer accumulated products and intermediate overflow (Specified by)
- PPL-SPEC-000831 Exact same-storage native integer arithmetic (Specified by)
- PPL-SPEC-000837 Native integer arithmetic with exact powers of two (Specified by)
- PPL-SPEC-001663 Native integer overflow primitives (Specified by)
- PPL-SPEC-000296 GCD normalization of raw coefficient vectors (Specified by)
- PPL-SPEC-000297 Support-aware callback combinations (Specified by)
- PPL-SPEC-000298 Whole-row linear combinations across row storage (Specified by)
- PPL-SPEC-000299 Range-limited linear combinations preserve outside coordinates (Specified by)
- PPL-SPEC-001639 Native integral checked-number value move (Specified by)
- PPL-SPEC-001640 Consuming coefficient relocation (Specified by)
- PPL-SPEC-000511 Exact named arithmetic on unbounded integer storage (Specified by)
- PPL-SPEC-000512 Exact unbounded integer product accumulation (Specified by)
- PPL-SPEC-000515 Unbounded integer arithmetic with powers of two (Specified by)
For each supported integer coefficient profile, successful addition, subtraction and multiplication shall produce the mathematical integer result whenever that result is representable in the profile.
Mathematical domain operations depend on coefficient arithmetic preserving meaning. Representability limits and resource failures remain distinct from successful calculation.
Verification covers coefficient arithmetic and its exact-result and arithmetic-precondition contracts. Related obligations: 🔗 5. Integer quotient and remainder semantics, 🔗 6. Exact rational arithmetic, 🔗 1. Meaning of successful exact and approximate results.
Compare results with independently computed arbitrary-precision integer results for zero, positive and negative operands, cancellation and representable boundary cases. Exercise every supported coefficient profile; do not interpret unchecked overflow cases as evidence for exactness.
README.configure.md: section 4, Enabling the Use of Alternative Coefficient Types. src/Coefficient_types.hh: coefficient profile and bounded-integer policy. configure.ac: coefficient selection.
-
16. Complete-tree cursor positions, topology and occupied-node search UID: PPL-SPEC-001629 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: The internal tree_iterator shall borrow one allocated complete-tree layout of 🔗 1. Ordered coefficient-map values and valid tree use. Let R = 2h − 1 > 0 be its reserved slot count and r = (R + 1) ⁄ 2 its root slot. A valid cursor shall store a physical slot 1 ≤ i ≤ R and its offset o = 2v2(i). Physical slots may be unoccupied. The source tree shall outlive the cursor; structural replacement shall invalidate it.
Root construction and get_root() shall select (r, r). Physical-slot construction shall select the admitted slot and its offset. Construction or assignment from a live same-tree logical iterator shall select that occupied slot. Copies shall retain owner and position; assignment between cursors shall require the same owner and return the target. Equality and inequality shall compare physical positions within the same owner.
For o > 1, left and right movement shall select (i − o ⁄ 2, o ⁄ 2) and (i + o ⁄ 2, o ⁄ 2). Parent movement shall require a non-root position and select its complete-tree parent. is_root() shall hold at r; is_leaf() shall hold exactly when o = 1. is_right_child() shall be false at the root and otherwise identify the parent's right child. dfs_index() shall return i and get_offset() shall return o. depth() shall return log2((R + 1) ⁄ o), counting the root as depth one.
index() shall access the key at the selected slot, including the unused_index marker for an unoccupied slot. Const access shall return the key value; mutable access shall borrow the stored key. Dereference shall require an occupied slot and access its coefficient, borrowing a mutable or const value as declared. Direct key updates shall satisfy the tree's staging and ordering conditions before the tree is again used as a valid map.
For an occupied current node, follow_left_children_with_value() and follow_right_children_with_value() shall select the occupied minimum-key and maximum-key nodes in that node's complete subtree, respectively. go_down_searching_key(k) shall require an occupied starting node and k != unused_index. It shall search that subtree, stopping at the key if present or at its prospective parent if absent. Navigation shall preserve the tree's keys and coefficients. The local OK() check shall accept exactly the admitted physical range with the matching stored offset; it shall not establish map ordering or coefficient validity.
Borrowing iterator constructors shall reject temporary backing owners. Copying temporary iterator values shall remain admitted when their backing storage remains alive.
RATIONALE: Physical tree navigation needs an explicit complete-tree position and borrowed lifetime, independently of logical stored-key iteration.
INTERFACE: Names belong to Parma_Polyhedra_Library; member excerpts apply to the internal nested CO_Tree::tree_iterator.
// Internal nested type CO_Tree::tree_iterator: explicit tree_iterator(CO_Tree&); tree_iterator(CO_Tree&, dimension_type physical_slot); tree_iterator(const tree_iterator&); tree_iterator(const CO_Tree::iterator&, CO_Tree&); tree_iterator& operator=(const tree_iterator&); tree_iterator& operator=(const CO_Tree::iterator&); bool operator==(const tree_iterator&) const; bool operator!=(const tree_iterator&) const; void get_root(); void get_left_child(); void get_right_child(); void get_parent(); void follow_left_children_with_value(); void follow_right_children_with_value(); void go_down_searching_key(dimension_type); bool is_root() const; bool is_right_child() const; bool is_leaf() const; Coefficient& operator*(); Coefficient_traits::const_reference operator*() const; dimension_type& index(); dimension_type index() const; dimension_type dfs_index() const; dimension_type get_offset() const; CO_Tree::height_t depth() const; // Private invariant check: bool OK() const;
VERIFICATION_CRITERIA: Enumerate every physical slot of small complete layouts and compare navigation with an independent root-to-leaf topology. Check copies, same-owner assignments, const/mutable accesses, subtree extrema and present/absent searches against literal ordered maps. Inspect the invariant rejection cases. Check lvalue admission and temporary-owner rejection with compile-time client expressions. Preserve temporary iterator/view use and lvalue storage identity in runtime checks.
SOURCE: src/CO_Tree_defs.hh; src/CO_Tree_inlines.hh; src/CO_Tree.cc; tests/CO_Tree/cotreespec1.cc. tests/rowstoragespec1.cc.
-
Incoming links from: 6. Coefficient zero and one constant access 8. Reduction of an integral coefficient pair2
1. Configured integral coefficient type and return trait UID: PPL-SPEC-000041 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The public Coefficient alias shall designate the configured integral coefficient type. The mpz profile shall select mpz_class (also named GMP_Integer). For each supported width n ∈ {8, 16, 32, 64}, checked-intN shall select Checked_Number<intN_t, Bounded_Integer_Coefficient_Policy> and native-intN shall select Checked_Number<intN_t, Checked_Number_Transparent_Policy<intN_t>>. Here N in a profile or type name denotes that selected width.
The bounded profiles shall represent the mathematical integers from − 2n − 1 through 2n − 1 − 1, inclusive. The mpz profile shall have no fixed-width integer range limit; available resources still limit computations. A native profile shall not promise overflow checking. The selection shall not introduce a global 128-bit coefficient type or change the meaning of coordinate indices.
Coefficient_traits shall be Coefficient_traits_template<Coefficient>. Its const_reference shall be const Coefficient& for mpz and both 64-bit bounded profiles, and Coefficient for the 8-, 16- and 32-bit bounded profiles. This trait shall determine whether a constant accessor returns a borrowed reference or a value, as specified by 🔗 6. Coefficient zero and one constant access.
RATIONALE: Profile identity determines range, overflow policy and whether returned constants are borrowed values. A common alias does not erase these configuration-dependent contracts.
INTERFACE: Public header: <ppl.hh>; names belong to Parma_Polyhedra_Library. The configured header shall expose one selected coefficient alias and its trait alias. Representative configured declarations:
// mpz configuration: typedef mpz_class Coefficient; typedef Coefficient_traits_template<Coefficient> Coefficient_traits; // checked-int8 configuration instead: // typedef Checked_Number<int8_t, // Bounded_Integer_Coefficient_Policy> Coefficient; // native-int8 configuration instead: // typedef Checked_Number<int8_t, // Checked_Number_Transparent_Policy<int8_t>> Coefficient;
The same bounded forms shall apply with int16_t, int32_t or int64_t for the other configured widths.
VERIFICATION_CRITERIA: For all nine configured profiles, check the selected type, width, signed range and exact return-trait type at compile time. Check that the coefficient-kind selection is unique. Compile clients against the matching public header; distinguish these checks from unrelated native 128-bit capabilities.
SOURCE: src/Coefficient_types.hh; src/GMP_Integer_types.hh; configure.ac; tests/coefficient2.cc.
-
Incoming links from: 3. Exact ordinary integral coefficient arithmetic 8. Coefficient scaling and truncated division by powers of two 1. Integral coefficient representation access and sign comparison 2. Coefficient negation and absolute-value assignment 3. Coefficient remainder assignment and exact division 4. Coefficient greatest common divisor and least common multiple 5. Extended integral greatest common divisor 6. Integral product accumulation and subtraction 7. Nonnegative integer square-root assignment 8. Reduction of an integral coefficient pair 9. Integral parity, additive inverses and extremum assignment11
2. Finite coefficient construction, copying and comparison UID: PPL-SPEC-000042 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: A default-constructed Coefficient shall have value zero. Construction from a representable native integral input and copying from a live coefficient shall preserve the source integer value. The common native input forms covered here are char, signed char, unsigned char, short, unsigned short, int, unsigned int, long and unsigned long. Copy assignment shall replace the target value with the source's entry value, return a reference to the target and preserve a distinct source. Self-copy assignment shall preserve the value. Later mutation of a value shall not change a distinct copy. Destruction of one value shall not invalidate another value or a separately owned copy of a constant.
For live finite coefficient values, equality and ordering comparisons shall agree with equality and ordering of their mathematical integers and shall preserve the operands. These obligations shall hold independently of object identity and the current floating-point rounding direction.
Construction and use shall satisfy the applicable initialized-thread protocol in 🔗 3. Thread initialization, default state and finalization. Callers shall prevent concurrent access to an object while another operation changes it. This contract's integral-input guarantee requires the input value to be representable in the selected profile.
RATIONALE: Coefficients must retain integer value semantics across the selected backend, even when that backend owns dynamically allocated limbs.
INTERFACE: Public header: <ppl.hh>. The selected coefficient provider shall admit these forms in a C++ client function using PPL names:
Coefficient zero; Coefficient x(7); Coefficient y(x); Coefficient& target = (y = x); y = y; bool equal = (x == y); bool different = (x != y); bool less = (x < y); bool less_equal = (x <= y); bool greater = (x > y); bool greater_equal = (x >= y);
The literals illustrate admitted calls; the value guarantees apply to all representable operands in this contract.
VERIFICATION_CRITERIA: Check default zero, positive and negative integral construction, copy construction, assignment return identity, self-assignment and independent later mutation. Compare all six predicates against an independent integer ordering, including bounded endpoints and large multi-limb GMP values. Destroy original values while retaining copies. Exercise assertion and nonassertion builds.
SOURCE: src/Coefficient_types.hh; src/Checked_Number_inlines.hh; GMP integer provider; tests/coefficient2.cc.
-
3. Exact ordinary integral coefficient arithmetic UID: PPL-SPEC-000043 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For live finite coefficients with mathematical entry values a and b, successfully materialized addition, subtraction and multiplication shall produce a + b, a − b and ab, respectively. Unary plus shall preserve the value and unary minus shall produce − a.
Compound addition, subtraction and multiplication shall replace the target by the corresponding result computed from the operands' entry values and return a reference to the target. This shall include an operand that is the target itself. Prefix increment and decrement shall change the value by one and return a reference to the changed target. Postfix forms shall make the same change and return an independent value equal to the target's entry value.
The mathematical result of every evaluated arithmetic step shall be representable in the selected bounded profile. Operand values shall remain unchanged unless they designate the assigned target. Results formed by the GMP expression-template provider shall be evaluated while their referenced operands remain alive. The initialized-thread and synchronization prerequisites of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Checked overflow reporting is specified by 🔗 5. Checked coefficient overflow and result-policy dispatch; native overflow is outside the successful-result preconditions.
RATIONALE: Exact integer arithmetic is the common foundation of the domains. Entry-value semantics make self-aliasing and increment/decrement results precise without constraining backend expression representation.
INTERFACE: Public header: <ppl.hh>. The selected provider shall admit these materializing forms for live Coefficient operands a and b:
Coefficient sum(a + b); Coefficient difference(a - b); Coefficient product(a * b); Coefficient positive(+a); Coefficient negative(-a); Coefficient& added = (a += b); Coefficient& subtracted = (a -= b); Coefficient& multiplied = (a *= b); Coefficient& incremented = ++a; Coefficient old_increment(a++); Coefficient& decremented = --a; Coefficient old_decrement(a--);
Intermediate arithmetic expression types may differ between providers. Materializing the result as Coefficient shall produce the stated integer value.
VERIFICATION_CRITERIA: Compare zero, mixed signs, cancellation, products and representable endpoint-adjacent results with literal or independently computed integer answers. Check compound return identity, preservation of distinct operands, self-add/subtract/multiply within range, and prefix/postfix entry values. Include multi-limb GMP cases and avoid executing native overflow. Check results after independent operand mutations.
SOURCE: src/Coefficient_types.hh; src/Checked_Number_inlines.hh; GMP integer provider; tests/coefficient2.cc.
-
8. Coefficient scaling and truncated division by powers of two UID: PPL-SPEC-000048 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a live finite coefficient with entry value a and an unsigned exponent e, successful mul_2exp_assign(x, y, e) shall assign a2e to x, where a is y's entry value. Successful div_2exp_assign(x, y, e) shall assign trunc(a ⁄ 2e) to x. Truncation shall be toward zero for either sign. The exponent zero shall preserve the input value.
The destination may be the source itself. A distinct source shall remain unchanged. A successful bounded multiplication result shall be representable. For native bounded multiplication, the exponent shall additionally be less than the selected width. These conditions shall include multiplying -1 by the power whose exponent is one less than that width, producing the least representable integer without undefined intermediate signed overflow.
Bounded division shall admit every unsigned int exponent; an exponent at least as large as the coefficient width shall produce zero. Checked bounded multiplication shall also admit every such exponent: a zero source shall produce zero, while a nonzero source with an exponent at least as large as the width shall report overflow. The mpz profile shall admit the unsigned int exponent range subject to available computational resources.
Checked bounded multiplication whose result is outside the coefficient range, with other input prerequisites satisfied, shall report std::overflow_error and retain the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. Native bounded operations shall not promise overflow detection. The initialized-thread and synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply.
RATIONALE: Scaling by powers of two is an integer operation, including at the negative range boundary. A representable result must not be invalidated by an overflowing signed intermediate. Division must retain the same truncation convention as ordinary integer quotient calculation.
INTERFACE: Public header: <ppl.hh>. For Coefficient operands in Parma_Polyhedra_Library, the selected provider shall admit:
void mul_2exp_assign(Coefficient& x, const Coefficient& y, unsigned int exp); void div_2exp_assign(Coefficient& x, const Coefficient& y, unsigned int exp);
For a bounded profile these callable forms are supplied by function-template instantiations for the configured coefficient type.
VERIFICATION_CRITERIA: Check zero and nonzero exponents, positive and negative inputs, zero values, destination/source aliasing and preservation of distinct sources. Include the negative sign-bit boundary in every bounded width, multi-limb GMP values, and literal signed-division answers. Compare checked positive and negative overflow with the required exception and explicitly reassign surviving outputs. Run native valid-result cases under undefined-behavior sanitization and confirm that introducing an overflowing signed intermediate is detected by the boundary regression.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh: GMP helpers. src/Checked_Number_inlines.hh: bounded coefficient helper dispatch. src/checked_int_inlines.hh: bounded scaling and division. tests/coefficient2.cc: configured dyadic arithmetic and boundary cases.
-
2. Coefficient negation and absolute-value assignment UID: PPL-SPEC-000052 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For live finite coefficients with source entry value a, neg_assign(x, y) shall assign − a and abs_assign(x, y) shall assign |a|, where y supplies a. The one-argument forms shall apply the same operation to the destination's own entry value. The two-argument destination may be the source itself.
A successful bounded result shall be representable. In checked profiles, negating or taking the absolute value of the least representable integer shall report std::overflow_error and retain the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. A native bounded caller shall satisfy the representability precondition.
The initialized-thread and object-synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Distinct source objects shall remain unchanged. The mpz profile shall be subject to available computational resources.
RATIONALE: Named assignments must retain the same mathematical sign conventions as ordinary coefficient arithmetic, including supported in-place use.
INTERFACE: Public header: <ppl.hh>. The selected coefficient provider shall admit:
void neg_assign(Coefficient& x); void neg_assign(Coefficient& x, const Coefficient& y); void abs_assign(Coefficient& x); void abs_assign(Coefficient& x, const Coefficient& y);
Bounded forms shall be the corresponding function-template instantiations.
VERIFICATION_CRITERIA: Check all four forms for zero and both signs, explicit two-argument self-aliasing, preservation of a distinct source, and large GMP values. Check bounded endpoint-adjacent results and require overflow exceptions for both checked MIN operations, then reassign surviving outputs.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/coefficient4.cc.
-
Incoming link from: 1. Native integer accumulated products and intermediate overflow1
6. Integral product accumulation and subtraction UID: PPL-SPEC-000056 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For destination and source entry values d, a and b, successful add_mul_assign(x, y, z) shall assign d + ab and successful sub_mul_assign(x, y, z) shall assign d − ab. The destination may be either or both sources, and the two sources may be the same object; each operand shall be interpreted at entry.
Successful bounded use shall require both the product ab and the final sum or difference to be representable. These shall be two arithmetic steps, with no promise of a wider fused accumulator. A checked overflow in either step shall report std::overflow_error with the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. This shall include an unrepresentable product whose addition to or subtraction from the destination could have cancelled into range: the operation may fail at that intermediate step. Native bounded callers shall satisfy both representability conditions.
The initialized-thread and object-synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Distinct source objects shall remain unchanged. The mpz profile shall be subject to available computational resources.
RATIONALE: Product accumulation is useful without an extra coefficient object, but a bounded two-step computation does not imply fused mathematical range.
INTERFACE: Public header: <ppl.hh>. The selected coefficient provider shall admit:
void add_mul_assign(Coefficient& x, const Coefficient& y, const Coefficient& z); void sub_mul_assign(Coefficient& x, const Coefficient& y, const Coefficient& z);
Bounded forms shall be function-template instantiations.
VERIFICATION_CRITERIA: Check zero, mixed signs, cancellation and all operand alias patterns with entry-value answers. Include multi-limb GMP products. For checked profiles separately overflow the product in both signs with positive, zero and negative destinations, and overflow only the final sum or difference. Require overflow also when a product overflow could have cancelled into range; reassign surviving outputs.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; src/checked_int_inlines.hh; tests/coefficient4.cc.
-
Incoming link from: 6. Sparse equality and line pivot selection1
1. Forward elimination and augmented equality/line rank UID: PPL-SPEC-000425 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Constraint and polyhedral-generator instantiations shall follow 🔗 1. Internal geometric-row sequences and valid bookkeeping. The separate line-only Grid_Generator case below shall use its stated prerequisites.
For constraint or polyhedral-generator rows, gauss(k) shall require no pending rows and exactly k equality/line rows grouped at the beginning. It shall return the rational rank of their stored coefficient vectors, including ordinary constant and applicable epsilon columns. It shall retain the equality/line row span, choose pivots from higher columns toward lower columns, place an independent triangular basis in the returned-rank prefix and reduce the remaining equality/line rows to zero vectors. Row count and non-equality/non-line rows shall be retained. Constant-only independent equalities, including an inconsistent equality, shall participate in the rank.
Dependent zero line vectors may remain as internal intermediate rows until removed; their owned coefficient layouts and common container metadata shall remain valid. Internal metadata queries, numeric-field inspection, removal cleanup and back substitution with zero rows outside its basis shall admit these intermediates. They shall not be exposed as public line descriptors. Common dimension, topology, storage and no-pending state shall be retained, and the sorted certificate shall be cleared whenever its truth is no longer established. All coefficient calculations shall satisfy 🔗 1. Internal geometric-row sequences and valid bookkeeping. For a Linear_System<Grid_Generator> containing only grid lines, with no pending rows, the same rational direction-span and rank/basis guarantees shall hold. Grid points and integer-lattice parameters are outside this extension: these operations do not promise to preserve a parameter lattice. A zero residual line is an admitted internal intermediate and contributes no direction; it shall be removed or skipped before constructing public grid generators. The common stored dimensions and representation shall remain valid.
RATIONALE: Forward elimination computes a basis of coefficient rows independently of whether affine equalities have a solution.
INTERFACE: dimension_type Linear_System<Row>::gauss(dimension_type k);
VERIFICATION_CRITERIA: Compare rank and coefficient-row spans with independent exact rational elimination using the opposite pivot direction. Check basis rank, descending pivot columns, zero dependent tails, unchanged other rows and constant-pivot cases. Check wide empty prefixes, early complete bases, full-column scans, dependent tails and unchanged nonbasis rows, processing state and sorted certificates.
SOURCE: src/Linear_System_defs.hh; src/Linear_System_templates.hh; src/Constraint_System_inlines.hh; src/Generator_System_inlines.hh; tests/linearsystemalgorithmsspec1.cc; tests/linearsystem1.cc; tests/Grid/linearelimination1.cc.
-
2. Back substitution through a triangular nonconstant basis UID: PPL-SPEC-000426 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Constraint and polyhedral-generator instantiations shall follow 🔗 1. Internal geometric-row sequences and valid bookkeeping. The separate line-only Grid_Generator case below shall use its stated prerequisites.
back_substitute(k) shall require no pending rows and a leading independent triangular equality/line basis of k rows, with nonzero pivots outside the ordinary constant column. Leading basis rows shall be line/equality rows, with pivots in strictly descending column order. Each pivot shall be eliminated from the other basis rows and from the remaining rows by exact linear combination, preserving the basis row span. Combining an inequality, ray or point with a basis row shall use positive scaling of that non-basis row.
For constraints this shall preserve the conjunction with the equality basis; for generators it shall preserve the generated combinations modulo the line span. Residual zero direction rows may remain as redundant internal rows. Zero direction rows shall require internal removal cleanup before public descriptor use. They shall remain admitted for numeric-field inspection and container metadata queries under 🔗 1. Internal geometric-row sequences and valid bookkeeping. Shape, topology, storage, row count and no-pending state shall be retained; certificates shall remain truthful. Numerical prerequisites shall follow 🔗 1. Internal geometric-row sequences and valid bookkeeping. For a Linear_System<Grid_Generator> containing only grid lines, with no pending rows, the same rational direction-span and rank/basis guarantees shall hold. Grid points and integer-lattice parameters are outside this extension: these operations do not promise to preserve a parameter lattice. A zero residual line is an admitted internal intermediate and contributes no direction; it shall be removed or skipped before constructing public grid generators. The common stored dimensions and representation shall remain valid.
RATIONALE: A nonconstant triangular pivot permits substitution without negating an inequality or changing a one-sided generator combination.
INTERFACE: void Linear_System<Row>::back_substitute(dimension_type k);
VERIFICATION_CRITERIA: Check exact basis row-span preservation and independent rational constraint satisfaction, including inequalities and strict inequalities. For generators compare the line subspace and point/ray quotient coordinates, including negative pivots and zero residual directions.
SOURCE: src/Linear_System_defs.hh; src/Linear_System_templates.hh; src/Constraint_System_inlines.hh; src/Generator_System_inlines.hh; tests/linearsystemalgorithmsspec1.cc; tests/linearsystem1.cc; tests/Grid/linearelimination1.cc.
-
3. Simplification of equality and line subsystems UID: PPL-SPEC-000427 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Row shall be Constraint or Generator. Valid use shall follow 🔗 1. Internal geometric-row sequences and valid bookkeeping.
With no pending rows, simplify() shall establish a leading independent basis of the meaningful nonzero line/equality coefficient rows and back-substitute that basis into the remaining rows. It may remove dependent rows or retain them as redundant zero coefficient rows. The result shall preserve constraint conjunction or polyhedral-generator combinations modulo the line span. An inconsistent equality subsystem shall remain inconsistent rather than being treated as a consistent affine space. The nonzero basis rank shall be retained independently of the stored line/equality row count.
It shall retain public dimension, topology, storage and no-pending state. Other rows need not be minimized for all geometric redundancy. Residual zero equality rows may remain as tautologies; zero direction rows shall require row-validity cleanup before public descriptor use. Internal numeric-field inspection, metadata queries and removal cleanup shall admit these intermediate rows. Sorted-prefix certificates shall be truthful. Numerical and resource prerequisites shall follow 🔗 1. Internal geometric-row sequences and valid bookkeeping.
RATIONALE: Partial simplification establishes the meaningful basis while permitting redundant zero storage rows and separate public direction cleanup.
INTERFACE: void Linear_System<Row>::simplify();
VERIFICATION_CRITERIA: Compare exact ranks and before/after conjunctions using independent rational valuations; compare generator line spans and quotient combinations. Check dependent equalities/lines, mixed row kinds, all-equality inputs, inconsistent equations and repeated simplification.
SOURCE: src/Linear_System_defs.hh; src/Linear_System_templates.hh; src/Constraint_System_inlines.hh; src/Generator_System_inlines.hh; tests/linearsystemalgorithmsspec1.cc; tests/linearsystem1.cc.
-
4. Sorting rows together with their saturation records UID: PPL-SPEC-000428 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Row shall be Constraint or Generator. Valid use shall follow 🔗 1. Internal geometric-row sequences and valid bookkeeping.
sort_and_remove_with_sat(sat) shall require a valid bit matrix with one row for each processed system row, in matching order. It shall sort and deduplicate that processed prefix by the same row predicates as 🔗 19. Sorting processed prefixes or single-status row windows, moving each retained bit row with its corresponding geometric row. On duplicate elimination it shall retain one original paired record; callers shall require equivalent saturation records for duplicate geometric rows when that equivalence is needed by the consuming algorithm.
The matrix column count shall be retained and its resulting row count shall equal the new processed boundary. Pending rows shall remain pending with their multiset preserved, although their order may change. System dimensions, topology and storage shall be retained and the processed prefix certified sorted. Zero/one processed row shall be admitted.
RATIONALE: A row permutation must preserve the association with the incidence information consumed by later numerical algorithms.
INTERFACE: void Linear_System<Row>::sort_and_remove_with_sat(Bit_Matrix& sat);
VERIFICATION_CRITERIA: Associate independent label-derived bit sets with rows, then check retained pairs through sorting/deduplication, empty/one-row prefixes and pending suffixes. Verify exact prefix/matrix dimensions and unchanged saturation columns.
SOURCE: src/Linear_System_defs.hh; src/Linear_System_templates.hh; src/Constraint_System_inlines.hh; src/Generator_System_inlines.hh; tests/linearsystemalgorithmsspec1.cc; tests/linearsystem1.cc.
-
5. Adding processed rows for new coordinate axes UID: PPL-SPEC-000429 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Row shall be Constraint or Generator. Valid use shall follow 🔗 1. Internal geometric-row sequences and valid bookkeeping.
For a positive admitted n, add_universe_rows_and_space_dimensions(n) shall append n zero-extended public coordinates to old rows and introduce n leading processed line/equality rows spanning exactly the new coordinate axes. Each new row shall have one positive unit coefficient at a distinct new axis, with all other public and ordinary constant coefficients zero. No new row shall add a supporting included point or a nonzero epsilon term.
Old rows shall retain their order, values at old coordinates and pending status. Row count, dimension and processed boundary shall each increase by n; topology and storage shall be retained and hidden epsilon fields shall remain hidden at the new layout location. Empty initial row collections shall be admitted. Certificates shall remain truthful. For constraints the new equalities fix the new coordinates to zero; for generators the new lines supply arbitrary real displacement in them.
RATIONALE: The same new-axis row construction supplies equations or line directions according to its row type.
INTERFACE: void Linear_System<Row>::add_universe_rows_and_space_dimensions(dimension_type n);
VERIFICATION_CRITERIA: Check new-axis unit vectors as an independent multiset, preserved old rows/pending status and relocated epsilon fields in both topologies. Include one/multiple added axes, empty initial collections and existing processed/pending rows.
SOURCE: src/Linear_System_defs.hh; src/Linear_System_templates.hh; src/Constraint_System_inlines.hh; src/Generator_System_inlines.hh; tests/linearsystemalgorithmsspec1.cc; tests/linearsystem1.cc.
-
6. Sparse equality and line pivot selection UID: PPL-SPEC-001649 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: gauss_sparse(k) shall require sparse representation, a positive leading line/equality count k and the valid no-pending grouping required by 🔗 1. Forward elimination and augmented equality/line rank. It shall return the augmented rational rank and establish the same ordered coefficient rows and common metadata as descending column elimination under that contract. Among remaining rows it shall choose the greatest nonzero column and the first row containing that column. Constant-only equality pivots shall participate; an all-zero remainder shall end elimination. A line's divisor column shall remain zero.
The equality/line row span, row count, topology, dimension, storage and nonbasis rows shall be preserved. The sorted certificate shall be cleared when rows are swapped or combined. Valid sparse expression storage shall satisfy 🔗 7. Backend row export, serialization, diagnostics and accounting; its stored entries shall be nonzero. Numerical and lifetime prerequisites shall follow 🔗 1. Internal geometric-row sequences and valid bookkeeping.
RATIONALE: The greatest last-nonzero index of the remaining rows identifies the same pivot as a descending column scan while skipping columns that are all zero.
INTERFACE: Internal source header: Linear_System_defs.hh; namespace Parma_Polyhedra_Library. The private member belongs to Linear_System<Row> for Row equal to Constraint or Generator.
dimension_type gauss_sparse(dimension_type k);
VERIFICATION_CRITERIA: Compare exact ordered rows with dense elimination and rank and spans with an independent rational oracle. Include tied tails, row swaps, sparse gaps, constant-only pivots, zero residuals, closed and NNC systems, and unchanged nonbasis rows, pending state and sorted certificates.
SOURCE: src/Linear_System_defs.hh; src/Linear_System_templates.hh; tests/linearsystemalgorithmsspec1.cc.
-
18. Row-wise normalization and certificate invalidation UID: PPL-SPEC-000418 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Normalization shall apply the corresponding row-type normalization to every retained row, including pending rows, without changing dimension, topology, storage or pending boundary. Strong normalization shall establish each row's common-factor/sign convention; sign normalization shall apply its sign rule. The certificate shall become true for at most one row and false otherwise, allowing a later explicit sort to establish row order. Numerical preconditions shall follow 🔗 1. Internal geometric-row sequences and valid bookkeeping.
RATIONALE: Row normalization can change sort keys even when the represented relation is retained.
INTERFACE: void Linear_System<Row>::strong_normalize(); void Linear_System<Row>::sign_normalize();
VERIFICATION_CRITERIA: Check literal nonprimitive row coefficients after internal truncation, row-specific normalization, pending rows, repeated idempotence and certificate values.
SOURCE: src/Linear_System_defs.hh; src/Linear_System_inlines.hh; src/Linear_System_templates.hh; tests/linearsystemspec1.cc; tests/linearsystem1.cc.
-
Incoming link from: 4. Checked named product accumulation1
1. Native integer accumulated products and intermediate overflow UID: PPL-SPEC-000842 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the eleven native integer storage types and same-storage raw/checked forms in 🔗 1. Exact same-storage native integer arithmetic, entry values d, a and b shall denote the destination and two sources. When the product p = ab and complete expression are within the destination policy's finite interval, add_mul_assign_r shall assign d + p and sub_mul_assign_r shall assign d − p. They shall return V_EQ for each valid rounding request, including a strict relation flag.
When overflow checking is enabled and p is finite and representable, an unrepresentable final sum or difference shall have the range outcome of 🔗 4. Checked native arithmetic range outcomes. An unrepresentable product may cause an intermediate-overflow failure even if cancellation would bring the complete expression into range. V_UNKNOWN_NEG_OVERFLOW and V_UNKNOWN_POS_OVERFLOW shall identify the sign of that intermediate product overflow and promise no numeric answer. If the destination policy admits NaN, such a diagnostic shall leave its NaN representation; otherwise its payload shall be unspecified and reusable. No exactness, infinity or finite-result meaning shall be inferred from that payload.
An intermediate overflow may instead yield the range outcome of 🔗 4. Checked native arithmetic range outcomes when the complete expression is outside the finite interval. Every reported relation shall describe the complete expression's ordering relative to its reported computed value; an intermediate overflow shall not justify a false final-result relation. A successful finite answer shall equal the complete expression, including if an implementation recovers it after an intermediate range limit. No wider or fused accumulator shall be required.
With overflow checking disabled, both product and final expression shall be finite and representable. ROUND_NOT_NEEDED shall require those same two representability conditions. Entry values shall be finite for their own policies and lie in the destination policy's finite interval. The finite interval and raw destination policy shall follow 🔗 1. Exact same-storage native integer arithmetic.
The destination may be either source, the sources may share an object, and all arguments may be the same object. Each occurrence shall use its entry value, including the initial destination. Distinct sources shall remain unchanged. Calls shall require no rounding default or result handler and shall not invoke a handler. Live-object, synchronization, initialization and hardware-direction prerequisites shall follow 🔗 1. Exact same-storage native integer arithmetic. Configured coefficient convenience operations shall retain 🔗 6. Integral product accumulation and subtraction.
RATIONALE: A bounded two-step accumulator has distinct product and final range limits. Intermediate failure can be reported honestly without confusing it with a proved bound on the complete expression.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for the admitted argument types:
Result add_mul_assign_r(To& to, const X& x, const Y& y, Rounding_Dir dir); Result sub_mul_assign_r(To& to, const X& x, const Y& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use independent unbounded integer products and complete-expression oracles for all native storage types and reserved-value policies. Check exact products, final-only overflow, both product-overflow signs, cancellation, zero and nonzero destinations, all admitted requests and every alias pattern. Check that range relations apply to the complete expression, unknown diagnostics identify the product-overflow sign, distinct sources remain unchanged, no handler is invoked, outputs remain reusable and hardware direction is preserved without initialization.
SOURCE: src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_int_inlines.hh; src/checked_ext_inlines.hh; tests/nativeintegeraccumulationspec1.cc.
-
Incoming links from: 1. Same-storage checked compound arithmetic 1. Native integer accumulated products and intermediate overflow 1. Native integer accumulated products and intermediate overflow 1. Native integer accumulated products and intermediate overflow 2. Directed native integer division and delegated truncation 2. Directed native integer division and delegated truncation 3. Exact native truncated quotient and remainder 3. Exact native truncated quotient and remainder 4. Checked native arithmetic range outcomes 4. Checked native arithmetic range outcomes 1. Bounded native integer Bezout assignment 1. Bounded native integer Bezout assignment 1. Native integer arithmetic with exact powers of two 1. Native integer arithmetic with exact powers of two 2. Directed native integer division by powers of two 2. Directed native integer division by powers of two 3. Centered and nonnegative native integer dyadic residues 3. Centered and nonnegative native integer dyadic residues 1. Directed native integer square-root assignment 1. Directed native integer square-root assignment 2. Native integer greatest common divisor and least common multiple 2. Native integer greatest common divisor and least common multiple 1. Native integer floor, ceiling and truncation identity 1. Native integer floor, ceiling and truncation identity 2. Native integer negation and absolute value 2. Native integer negation and absolute value 11. Native integer overflow primitives 1. Policy-dependent native integer classification 1. Typed special-marker assignment to native integer storage 1. Typed special-marker assignment to native integer storage30
1. Exact same-storage native integer arithmetic UID: PPL-SPEC-000831 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For each of the eleven standard native integer storage types I, add_assign_r, sub_assign_r and mul_assign_r shall assign the exact mathematical sum, difference and product of their entry operands when the result is within the destination's finite range. They shall return V_EQ for each valid rounding direction, with or without ROUND_STRICT_RELATION. A rounding request shall not introduce a fractional approximation to an integer sum, difference or product.
Each argument shall have underlying storage type I, either as a raw integer or an admitted Checked_Number<I, Policy>. Entry operands shall be finite for their own source policies and lie in the destination policy's finite interval. That interval shall account for reserved representations as specified by 🔗 1. Bounded checked integer limits and reserved endpoints. A raw destination shall use the full native integer interval and overflow checking; a checked destination shall use its selected policy. If checking is disabled, the exact operation result shall be within that finite interval. Enabled range checking shall have the additional outcomes of 🔗 4. Checked native arithmetic range outcomes.
The output may alias either input, the two read-only inputs may alias each other, and all three arguments may be the same object. Every occurrence in the mathematical expression shall use its entry value. Distinct source objects shall remain unchanged. Named calls shall require no rounding default or result handler and shall not dispatch a handler. Objects shall be live and access overlapping mutation shall be synchronized. Calls shall require no library initialization, coefficient-constant stage or FPU setup and preserve hardware direction. Configured coefficient operators shall retain 🔗 3. Exact ordinary integral coefficient arithmetic; unbounded integer arithmetic shall retain 🔗 1. Exact named arithmetic on unbounded integer storage.
RATIONALE: Exact integer arithmetic must retain its meaning across storage widths, signedness and policies without invoking a convenience-interface handler.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for the admitted argument types:
Result add_assign_r(To& to, const X& x, const Y& y, Rounding_Dir dir); Result sub_assign_r(To& to, const X& x, const Y& y, Rounding_Dir dir); Result mul_assign_r(To& to, const X& x, const Y& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use independent unbounded integer oracles across all eleven storage types, signed and unsigned endpoints, cancellation, zero, product sign combinations and representability boundaries. Check all valid exact requests, raw and checked operands, source preservation and every admitted alias. Exercise policies with and without overflow checking within their valid ranges.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_ext_inlines.hh; tests/nativeintegerarithmeticspec1.cc.
-
Incoming link from: 5. Checked named scaling by powers of two1
1. Native integer arithmetic with exact powers of two UID: PPL-SPEC-000837 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the eleven standard native integer storage types and same-storage raw/checked forms in 🔗 1. Exact same-storage native integer arithmetic, let m = 2e for an unsigned int exponent e. add_2exp_assign_r, sub_2exp_assign_r and mul_2exp_assign_r shall assign the exact mathematical integers x + m, x − m and xm when those results lie in the destination policy's finite interval. Each shall return V_EQ for every valid rounding request, including a strict flag.
With overflow checking enabled, all unsigned exponent values shall be admitted. A checked result outside the finite interval shall have the endpoint, extended-value or unrepresentability outcome of 🔗 4. Checked native arithmetic range outcomes. In particular, zero multiplied by any such power shall remain exact zero, without requiring the power to fit native storage. ROUND_NOT_NEEDED shall require a representable result.
For unchecked add/subtract, both the power and the exact result shall be representable in native I and the result shall be finite for the selected policy. For unchecked multiplication, the exponent shall be less than the native storage width in bits and the exact result shall be finite and representable. These preconditions shall apply even to a zero source when an unchecked implementation forms a native shift.
The source and destination may be the same object. Calculations shall use entry source values and preserve distinct sources. No rounding default or handler shall be required or invoked. Object lifetime, synchronization, initialization and hardware-direction conditions shall follow 🔗 1. Exact same-storage native integer arithmetic. The mathematical definition shall not impose an intermediate native limit on a checked operation's power of two.
RATIONALE: An exponent is a mathematical power parameter. Checked operations can decide large-power range outcomes without performing an invalid native shift; unchecked calls require explicit intermediate and shift preconditions.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for admitted argument types:
Result add_2exp_assign_r(To& to, const From& source, unsigned int e, Rounding_Dir dir); Result sub_2exp_assign_r(To& to, const From& source, unsigned int e, Rounding_Dir dir); Result mul_2exp_assign_r(To& to, const From& source, unsigned int e, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use independent unbounded or symbolic integer oracles for every native width, zero, signed minima, finite endpoints, cancellation, and exponents zero, below/at/above the sign and storage boundaries and UINT_MAX. Check valid exact requests, all range outcomes, raw/checked forms, source aliases and preserved hardware direction. Keep unchecked calls within both shift and intermediate representability preconditions.
SOURCE: src/checked_int_inlines.hh; src/checked_ext_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; tests/nativeintegerdyadicspec1.cc.
-
11. Native integer overflow primitives UID: PPL-SPEC-001663 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For each standard native integer storage type other than bool, the internal Checked::Integer_Overflow::add, sub and mul primitives shall accept two values and a destination of the same storage type. They shall return true exactly when the mathematical result lies outside that storage type's native range. They shall always assign the value congruent to the result modulo 2N, with N the storage width, including on overflow. The destination may alias either input.
Available compiler builtins and portable emulations shall satisfy the same contract without overflowing signed arithmetic. Policy-reserved infinity and NaN representations, rounding directions and result handlers shall remain the responsibility of the checked-arithmetic layer. Selection of a builtin shall not change 🔗 1. Exact same-storage native integer arithmetic or 🔗 4. Checked native arithmetic range outcomes.
When the corresponding builtin is unavailable or explicitly disabled, the checked-arithmetic layer shall retain its existing wider-carrier and range guard algorithms, without runtime dispatch to an alternative implementation.
RATIONALE: Separate machine-range detection from checked-number policy semantics. Select the builtin path only for signed, checked, finite-only policies with no configured wider carrier. Retain established arithmetic paths where builtin replacement has no measured benefit. In particular, no-builtin configurations need no new arithmetic cost. Retain established checked arithmetic on i686: new kernels changed PIE code placement enough to regress unchanged operations. Compiler availability remains independent of target selection for checked arithmetic.
INTERFACE: Internal source header: Integer_Overflow.hh; namespace Parma_Polyhedra_Library::Checked::Integer_Overflow.
template <typename T> constexpr bool add(T x, T y, T& out) noexcept; template <typename T> constexpr bool sub(T x, T y, T& out) noexcept; template <typename T> constexpr bool mul(T x, T y, T& out) noexcept; template <typename T> constexpr bool portable_add(T x, T y, T& out) noexcept; template <typename T> constexpr bool portable_sub(T x, T y, T& out) noexcept; template <typename T> constexpr bool portable_mul(T x, T y, T& out) noexcept;
VERIFICATION_CRITERIA: Compare raw results against an independent mathematical integer oracle for all byte pairs, wider boundary pairs and deterministic wider random pairs. Check the result even on overflow, input/output aliases and constant expressions. Repeat with builtins disabled and with unsigned plain char. Run the existing checked arithmetic and accumulation tests with builtin and legacy paths, including directed overflow and reserved finite endpoints. Compare generated arithmetic code and representative workload timings.
SOURCE: src/Integer_Overflow.hh; src/compiler.hh; src/checked_int_inlines.hh; tests/integeroverflowspec1.cc; tests/nativeintegerarithmeticspec1.cc; tests/nativeintegeraccumulationspec1.cc.
-
16. GCD normalization of raw coefficient vectors UID: PPL-SPEC-000296 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For a nonzero row, normalize() shall divide every coefficient by the positive greatest common divisor of all coefficient magnitudes. All-zero rows, including empty rows, shall be unchanged. Size and coefficient signs shall be retained. A common sign shall not be reversed. This operation shall change vector value when the common divisor exceeds one; it shall not be a representation-only operation. Numerical prerequisites shall follow 🔗 1. Internal coefficient-row values and valid use.
RATIONALE: Removing a positive common factor preserves proportional relations but does not preserve a raw affine vector value.
INTERFACE: void Dense_Row::normalize(); void Sparse_Row::normalize();
VERIFICATION_CRITERIA: Use independent integer GCD division with leading/trailing zeroes, mixed signs, common factors, relatively prime entries, negative-only entries, explicit sparse zeroes and size zero.
SOURCE: src/Dense_Row_defs.hh; src/Dense_Row_inlines.hh; src/Dense_Row_templates.hh; src/Dense_Row.cc; src/Sparse_Row_defs.hh; src/Sparse_Row_inlines.hh; src/Sparse_Row_templates.hh; src/Sparse_Row.cc; tests/rowstoragespec1.cc; tests/denserow1.cc.
-
17. Support-aware callback combinations UID: PPL-SPEC-000297 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For equal-sized rows and pointwise callback functions obeying the following identities, combination shall produce the vector obtained by applying g(x[i],y[i]) to each entry. Callbacks shall modify only their first coefficient argument; they shall not change another row position, row structure or external state on which another callback result depends. They shall admit aliased first/source arguments for self-operand calls. Invocation count/order shall not be promised. For combine_needs_first, g(0,b) shall leave zero unchanged and f(a) shall equal g(a,0). For combine_needs_second, g(a,0) shall leave a unchanged and h(0,b) shall equal g(0,b). For general combine, g(0,0) shall leave zero unchanged, with both f/h identities. Exact final values shall be independent of stored zeroes and storage type. Self-operand calls shall use each position's entry value as both operands. Sparse result zeroes may remain stored or be removed.
RATIONALE: Sparse evaluation can omit zero cases only when the callback algebra makes those omissions equivalent.
INTERFACE: template <typename F, typename G> void Dense_Row::combine_needs_first(const Dense_Row& y, const F& f, const G& g); template <typename G, typename H> void Dense_Row::combine_needs_second(const Dense_Row& y, const G& g, const H& h); template <typename F, typename G, typename H> void Dense_Row::combine(const Dense_Row& y, const F& f, const G& g, const H& h); template <typename F, typename G> void Sparse_Row::combine_needs_first(const Sparse_Row& y, const F& f, const G& g); template <typename G, typename H> void Sparse_Row::combine_needs_second(const Sparse_Row& y, const G& g, const H& h); template <typename F, typename G, typename H> void Sparse_Row::combine(const Sparse_Row& y, const F& f, const G& g, const H& h);
VERIFICATION_CRITERIA: Compare product, sum and signed difference callbacks with independent entry-value vectors; include disjoint/matching supports, zero cancellation, self operands and explicit stored zeroes.
SOURCE: src/Dense_Row_defs.hh; src/Dense_Row_inlines.hh; src/Dense_Row_templates.hh; src/Dense_Row.cc; src/Sparse_Row_defs.hh; src/Sparse_Row_inlines.hh; src/Sparse_Row_templates.hh; src/Sparse_Row.cc; tests/rowstoragespec1.cc; tests/sparserow1.cc; tests/rowstoragebranches1.cc.
-
Incoming link from: 19. Range-limited linear combinations preserve outside coordinates1
18. Whole-row linear combinations across row storage UID: PPL-SPEC-000298 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: With nonzero scalar coefficients c1 and c2, whole-row combination shall assign xi : = c1xi + c2yi from entry values. Dense/dense member or free forms shall require equal logical sizes. Sparse/sparse forms shall require distinct rows of equal size. The dense-destination/sparse-source whole-row free form shall require equal logical sizes. The sparse-destination/dense-source whole-row free form shall require x.size() >= y.size() and treat absent trailing source coordinates as zero. Target size shall be retained and distinct source values preserved. Dense self-operand calls shall use each position's entry value for both operands. Scalars shall remain live and independent of coefficients modified by the operation. Numerical/failure prerequisites shall follow 🔗 1. Internal coefficient-row values and valid use.
RATIONALE: A storage-specific optimization must compute the same exact coefficient combination over the declared vector extent.
INTERFACE: void Dense_Row::linear_combine(const Dense_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2); void Sparse_Row::linear_combine(const Sparse_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2); void linear_combine(Dense_Row& x, const Dense_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2); void linear_combine(Dense_Row& x, const Sparse_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2); void linear_combine(Sparse_Row& x, const Dense_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2); void linear_combine(Sparse_Row& x, const Sparse_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2);
VERIFICATION_CRITERIA: Compare every storage pairing and scalar optimization case with independent integer vectors, including cancellation, sparse tails, empty rows, mixed unequal extents and dense self operands. Check equal-extent dense/sparse whole-row combinations, including empty rows and scalar fast paths. Independently check public mixed-storage linear-expression combinations across shorter/equal/longer dimensions; public maximum-dimension and zero-extension behavior shall remain unchanged.
SOURCE: src/Dense_Row_defs.hh; src/Dense_Row_inlines.hh; src/Dense_Row_templates.hh; src/Dense_Row.cc; src/Sparse_Row_defs.hh; src/Sparse_Row_inlines.hh; src/Sparse_Row_templates.hh; src/Sparse_Row.cc; tests/rowstoragespec1.cc; tests/linearexpressionpublic1.cc; tests/rowstoragebranches1.cc.
-
19. Range-limited linear combinations preserve outside coordinates UID: PPL-SPEC-000299 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Range combination shall require start <= end within both logical sizes, nonzero scalars and the operand/scalar independence conditions of 🔗 18. Whole-row linear combinations across row storage. It shall assign xi : = c1xi + c2yi from entry values exactly for start ≤ i < end, leaving every other target coordinate unchanged. Empty windows shall preserve the complete vector. Storage pairing and optimized scalar cases shall not change that result.
RATIONALE: Range updates are reusable storage operations whose prefix and suffix are independently meaningful.
INTERFACE: void Dense_Row::linear_combine(const Dense_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2, dimension_type start, dimension_type end); void Sparse_Row::linear_combine(const Sparse_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2, dimension_type start, dimension_type end); void linear_combine(Dense_Row& x, const Dense_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2, dimension_type start, dimension_type end); void linear_combine(Dense_Row& x, const Sparse_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2, dimension_type start, dimension_type end); void linear_combine(Sparse_Row& x, const Dense_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2, dimension_type start, dimension_type end); void linear_combine(Sparse_Row& x, const Sparse_Row& y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2, dimension_type start, dimension_type end);
VERIFICATION_CRITERIA: Compare all windows of small literal vectors for all four storage pairings and scalar cases; include empty windows, cancellation, boundary stored entries and distinct outer tails.
SOURCE: src/Dense_Row_defs.hh; src/Dense_Row_inlines.hh; src/Dense_Row_templates.hh; src/Dense_Row.cc; src/Sparse_Row_defs.hh; src/Sparse_Row_inlines.hh; src/Sparse_Row_templates.hh; src/Sparse_Row.cc; tests/rowstoragespec1.cc.
-
Incoming link from: 2. Consuming coefficient relocation1
1. Native integral checked-number value move UID: PPL-SPEC-001639 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For an admitted native integral storage type T, move construction of Checked_Number<T, Policy> shall copy the source's stored integer value and preserve the source. It shall be a trivial, nonthrowing constructor and shall invoke neither a conversion operation nor Policy::handle_result. The wrapper shall have a trivial destructor and one native integral data member; it shall be an implicit-lifetime class under C++20. Its size and alignment shall equal those of T. These properties shall not imply that the wrapper is trivially copyable. The copy constructor and copy assignment shall retain their separately specified behavior.
This constructor shall be available only when Is_Native<T>::value is nonzero and std::is_integral_v<T> is true. GMP and floating-point storage shall retain the existing copy-from-rvalue behavior. The source shall be a live initialized object with an admitted stored representation; no library initialization, rounding setup, allocation or policy callback shall be required.
RATIONALE: A trivial eligible constructor and trivial destructor admit implicit lifetime creation for the native-integer wrapper while preserving policy-aware copies for other storage types.
INTERFACE: Names belong to Parma_Polyhedra_Library unless qualified otherwise. Template excerpts omit SFINAE return-type restrictions described in the text.
// Member of Checked_Number<T, Policy>: Checked_Number(Checked_Number&&) requires (Is_Native<T>::value != 0 && std::is_integral_v<T>) = default;
VERIFICATION_CRITERIA: Check trivial/nothrow move, trivial destruction, nontrivial copy, layout and size/alignment traits for every admitted native integral type; exercise zero, one and both range extrema with source preservation and a counting policy. Check independent GMP copies from rvalues and exclusion of floating storage. Inspect the C++20 lifetime argument separately from execution tests.
SOURCE: src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; tests/checkedmovespec1.cc; tests/scalaradapterspreinit1.cc.
-
2. Consuming coefficient relocation UID: PPL-SPEC-001640 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For the configured coefficient type, relocate_coefficient(to,from) shall transfer the entry source value to a distinct destination slot. relocate_coefficients(to,from,count) shall transfer the ordered sequence of count source values between disjoint ranges. relocate_coefficients_right(from,count,shift) shall transfer that sequence to the range beginning shift slots later in the same allocation; overlapping, touching and disjoint ranges, zero count and zero shift shall be admitted. Overlap shall preserve the entry sequence, as if its values were first retained before writing the destination.
Source slots shall contain live initialized coefficients. Destination-only slots shall be suitably aligned uninitialized or previously consumed storage. All pointers shall designate valid storage even when count is zero; the source and destination extents and byte-size products shall be representable and fit their allocations. After relocation the destination range shall hold live coefficients with the entry source values and ownership. Source-only slots shall be consumed: their old values shall neither be accessed nor destroyed; they may be reconstructed or their storage released without coefficient destruction. Overlap slots belonging to the destination shall remain live. No coefficient-owned resource shall be duplicated or lost.
The helpers shall be nonthrowing, allocate no storage and invoke no numerical conversion, policy handler or rounding control. They shall require no library initialization. Native integral coefficient relocation shall preserve each integer representation using the implicit-lifetime wrapper property of 🔗 1. Native integral checked-number value move.
RATIONALE: Dense and sparse storage need consuming ownership transfer into raw slots, including overlapping right shifts, without numerical conversion or extra allocations.
INTERFACE: Names belong to Parma_Polyhedra_Library unless qualified otherwise. Template excerpts omit SFINAE return-type restrictions described in the text.
void relocate_coefficient(Coefficient*, Coefficient*) noexcept; void relocate_coefficients(Coefficient*, Coefficient*, std::size_t) noexcept; void relocate_coefficients_right(Coefficient*, std::size_t, std::size_t) noexcept;
VERIFICATION_CRITERIA: Exercise single transfers, empty/disjoint ranges, every overlap pattern, touching ranges, zero shift, consumed-slot reconstruction and resource-owning values. Destroy only live outputs and use sanitizers for resource misuse. Inspect lifetime creation and integer-subobject representation preservation; test matching checked/native bounded configurations as well as GMP configurations.
SOURCE: src/Coefficient_relocation.hh; src/Coefficient_defs.hh; tests/coefficientrelocationspec1.cc.
-
Incoming links from: 1. Same-storage checked compound arithmetic 4. Checked unary signs and prefix increment or decrement 1. Checked named unary functions and function policy 1. Exact same-storage native integer arithmetic 2. Exact unbounded integer product accumulation 2. Exact unbounded integer product accumulation 3. Directed unbounded integer division and explicit delegated convention 3. Directed unbounded integer division and explicit delegated convention 4. Exact truncated unbounded integer quotient and remainder 4. Exact truncated unbounded integer quotient and remainder 5. Unbounded integer arithmetic with powers of two 5. Unbounded integer arithmetic with powers of two 6. Exact centered and nonnegative unbounded integer residues 1. Exact unbounded integer greatest common divisor and least common multiple 2. Exact unbounded integer Bezout coefficients 3. Directed unbounded integer square roots16
1. Exact named arithmetic on unbounded integer storage UID: PPL-SPEC-000511 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The source and destination objects shall be live mpz_class values, independently of the configured Coefficient alias. add_assign_r, sub_assign_r and mul_assign_r shall assign the exact sum, difference and product of the source integers. neg_assign_r and abs_assign_r shall assign exact negation and absolute value. floor_assign_r, ceil_assign_r and trunc_assign_r shall preserve an integer source's value. Every operation shall return V_EQ for each valid rounding direction, with or without ROUND_STRICT_RELATION.
The output may alias any source, and read-only sources may alias each other. Distinct sources shall remain unchanged. Calls shall require available resources for unbounded arithmetic and access synchronized against mutation. The stored integers and intermediates shall have no configured fixed-width coefficient limit. No library/thread initialization owner, coefficient-constant stage, floating-point backend setup, hardware direction, inexact flag or irrational-precision setting shall be required. Arithmetic/resource failure shall not be a successful result; no universal output rollback shall be promised after a reported failure.
RATIONALE: Named numerical operations must retain unbounded integer semantics even when the globally configured coefficient type has a bounded range.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result add_assign_r(mpz_class& to, const mpz_class& x, const mpz_class& y, Rounding_Dir dir); Result sub_assign_r(mpz_class& to, const mpz_class& x, const mpz_class& y, Rounding_Dir dir); Result mul_assign_r(mpz_class& to, const mpz_class& x, const mpz_class& y, Rounding_Dir dir); Result neg_assign_r(mpz_class& to, const mpz_class& from, Rounding_Dir dir); Result abs_assign_r(mpz_class& to, const mpz_class& from, Rounding_Dir dir); Result floor_assign_r(mpz_class& to, const mpz_class& from, Rounding_Dir dir); Result ceil_assign_r(mpz_class& to, const mpz_class& from, Rounding_Dir dir); Result trunc_assign_r(mpz_class& to, const mpz_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check literal small and very large signed integer arithmetic oracles, zero and cancellation, all eight requests, every permitted alias and unchanged distinct sources in all coefficient configurations.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerarithmeticspec1.cc.
-
Incoming link from: 4. Checked named product accumulation1
2. Exact unbounded integer product accumulation UID: PPL-SPEC-000512 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For live mpz_class objects and resources as in 🔗 1. Exact named arithmetic on unbounded integer storage, add_mul_assign_r shall replace the entry value z by z + ab and sub_mul_assign_r shall replace it by z − ab, where a and b are the entry source values. Both operations shall return V_EQ for every valid rounding request. Sources may alias each other or the accumulator, including all three arguments sharing one object. Every occurrence in the formula shall use its entry value. Distinct source objects shall remain unchanged. Resource, synchronization, range and initialization conditions shall follow 🔗 1. Exact named arithmetic on unbounded integer storage.
RATIONALE: An accumulator alias changes which entry values must be retained; the fused assignment remains exact regardless of coefficient configuration.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result add_mul_assign_r(mpz_class& to, const mpz_class& x, const mpz_class& y, Rounding_Dir dir); Result sub_mul_assign_r(mpz_class& to, const mpz_class& x, const mpz_class& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use independent literal results for all sign combinations, zero factors, very large products, separate operands and each accumulator/source alias, including all-three aliasing. Check all eight result requests and unchanged distinct sources.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerarithmeticspec1.cc.
-
5. Unbounded integer arithmetic with powers of two UID: PPL-SPEC-000515 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For mpz_class objects and prerequisites in 🔗 1. Exact named arithmetic on unbounded integer storage, let e be an unsigned exponent and m = 2e. Resources shall suffice for the requested power and output; there shall be no native shift-width precondition on e. add_2exp_assign_r, sub_2exp_assign_r and mul_2exp_assign_r shall assign exactly a + m, a − m and am, respectively, and return V_EQ for every valid rounding request.
div_2exp_assign_r shall round a ⁄ m downward or upward with the same directed value and relation rules as 🔗 3. Directed unbounded integer division and explicit delegated convention. ROUND_IGNORE shall truncate toward zero and return a relation admitting the actual comparison; a strict delegated request shall distinguish equality and strict inequality. ROUND_NOT_NEEDED shall require m to divide a, assign the exact quotient and return a relation admitting equality; a strict exactness request shall return V_EQ. This delegated truncation convention shall apply to power-of-two division independently of the ceiling convention for general div_assign_r.
Source/destination aliases, source preservation and other prerequisites shall follow 🔗 1. Exact named arithmetic on unbounded integer storage. Shared scratch-integer pools used to form an additive power shall be serialized in a build without thread-safe support; thread-safe configurations shall use calling-thread pools. No FPU setup, initialized library owner or coefficient-constant stage shall be needed.
RATIONALE: Unbounded integer shifts must not inherit a native coefficient width limit, while division still needs an explicit rounding convention and exactness precondition.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result add_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result sub_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result mul_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result div_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir);
VERIFICATION_CRITERIA: Exercise exponent zero, native-width boundaries and exponents above every bounded coefficient width with literal or independently derived integer powers. Check all signs, exact/inexact division, strict and delegated outcomes, aliases, source preservation and exactness requests when divisible.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerarithmeticspec1.cc.
-
1. Numerical and geometric foundations UID: PPL-HLR-000001 STATUS: APPROVED COMPONENT: LIBRARY_WIDE APPLICABILITY: ALL VERIFICATION_METHODS: Test, Analysis, Review RELATIONS (Child): - PPL-LLR-000446 Reloadable textual representations (Refined by)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Refined by)
- PPL-LLR-000012 Affine meaning of linear expressions (Refined by)
- PPL-LLR-000013 Meaning of linear constraints (Refined by)
- PPL-LLR-000014 Meaning of linear congruences (Refined by)
- PPL-LLR-000015 Distinct meanings of geometric generators (Refined by)
- PPL-LLR-000001 Exact integral coefficient calculations (Refined by)
- PPL-LLR-000002 Detection of checked coefficient overflow (Refined by)
- PPL-LLR-000003 Conservative directed numerical bounds (Refined by)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Refined by)
- PPL-LLR-000414 Integer quotient and remainder semantics (Refined by)
- PPL-LLR-000415 Exact rational arithmetic (Refined by)
STATEMENT: PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.
RATIONALE: Domains and solvers need a common interpretation of coefficients, coordinates, expressions, constraints and generators.
VERIFICATION_CRITERIA: Review the common mathematical definitions and their consistency across domains; exercise representative descriptor construction, arithmetic and dimension changes under each supported numerical configuration.
BIBLIOGRAPHY: BagnaraHZ08SCP | Whole work (background on the library's numerical abstractions and design).
SOURCE: doc/definitions.dox: Basic_Geometric_Descriptors, Syntactic_Geometric_Descriptors; src/Coefficient_defs.hh; src/Linear_Expression_defs.hh.
- PPL-SPEC-001523 C coefficient ownership, conversion and bounds (Specified by)
- PPL-SPEC-000045 Checked coefficient overflow and result-policy dispatch (Specified by)
- PPL-SPEC-000048 Coefficient scaling and truncated division by powers of two (Specified by)
- PPL-SPEC-000244 Floating-to-integral range detection and reusable destinations (Specified by)
- PPL-SPEC-000165 Integral scalar conversion range outcomes (Specified by)
- PPL-SPEC-000166 Rational conversion at and beyond integral endpoints (Specified by)
- PPL-SPEC-000052 Coefficient negation and absolute-value assignment (Specified by)
- PPL-SPEC-000053 Coefficient remainder assignment and exact division (Specified by)
- PPL-SPEC-000054 Coefficient greatest common divisor and least common multiple (Specified by)
- PPL-SPEC-000055 Extended integral greatest common divisor (Specified by)
- PPL-SPEC-000056 Integral product accumulation and subtraction (Specified by)
- PPL-SPEC-000058 Reduction of an integral coefficient pair (Specified by)
- PPL-SPEC-000555 Bounded integer coefficient policy configuration (Specified by)
- PPL-SPEC-000128 Exception classification of numerical result codes (Specified by)
- PPL-SPEC-000919 Exact scalar numerator and denominator extraction (Specified by)
For coefficient profiles that promise overflow checking, a requested coefficient calculation whose integer result is outside the representable range shall report overflow rather than report a wrapped or truncated value as a successful exact result.
Checked bounded arithmetic is intended to permit bounded storage without silently corrupting the mathematical computation.
Verification covers checked-coefficient overflow reporting and its observable failure outcomes. Related obligations: 🔗 1. Exact integral coefficient calculations, 🔗 5. Integer quotient and remainder semantics.
Use an independent unbounded-integer oracle to generate results immediately inside and outside both range limits. Confirm that representable results succeed and out-of-range results reach the documented failure outcome.
README.configure.md: section 4, checked and unchecked coefficients. src/Coefficient_types.hh: Bounded_Integer_Coefficient_Policy. src/Coefficient_inlines.hh: overflow handling.
-
1. C coefficient ownership, conversion and bounds UID: PPL-SPEC-001523 STATUS: APPROVED COMPONENT: C_INTERFACE APPLICABILITY: IF_C VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: C VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000202 C object ownership and borrowed access (Specifies)
- PPL-LLR-000203 C boundary error reporting (Specifies)
- PPL-LLR-000214 Mathematical consistency of corresponding binding operations (Specifies)
STATEMENT: Coefficient creation shall produce independent caller-owned zero, GMP-integer or copied values. Assignment and conversion to or from initialized mpz_t objects shall preserve the mathematical integer for every admitted value. For checked coefficient profiles, conversion from GMP with an out-of-range value shall report PPL_ARITHMETIC_OVERFLOW. Deletion shall release owned coefficients. The boundedness predicate shall identify the configured coefficient representation. Minimum/maximum queries shall assign bounds and return true for bounded coefficients, and return false without modifying the output for unbounded coefficients. OK shall report the coefficient representation's admitted validity.
The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.
RATIONALE: Host GMP values and library coefficients require exact conversion with explicit ownership.
INTERFACE: Public header: <ppl_c.h>.
int ppl_new_Coefficient(ppl_Coefficient_t *pc); int ppl_new_Coefficient_from_mpz_t(ppl_Coefficient_t *pc, mpz_t z); int ppl_new_Coefficient_from_Coefficient(ppl_Coefficient_t *pc, ppl_const_Coefficient_t c); int ppl_assign_Coefficient_from_mpz_t(ppl_Coefficient_t dst, mpz_t z); int ppl_assign_Coefficient_from_Coefficient(ppl_Coefficient_t dst, ppl_const_Coefficient_t src); int ppl_delete_Coefficient(ppl_const_Coefficient_t c); int ppl_Coefficient_to_mpz_t(ppl_const_Coefficient_t c, mpz_t z); int ppl_Coefficient_OK(ppl_const_Coefficient_t c); int ppl_Coefficient_is_bounded(void); int ppl_Coefficient_min(mpz_t min); int ppl_Coefficient_max(mpz_t max); int ppl_multiply_Linear_Expression_by_Coefficient(ppl_Linear_Expression_t le, ppl_const_Coefficient_t n);
VERIFICATION_CRITERIA: Check signed and large integers, copy/assignment independence, configured bounds, round trips and bounded overflow where configured.
SOURCE: interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.
-
Incoming links from: 3. Exact ordinary integral coefficient arithmetic 8. Coefficient scaling and truncated division by powers of two 2. Coefficient negation and absolute-value assignment 3. Coefficient remainder assignment and exact division 4. Coefficient greatest common divisor and least common multiple 5. Extended integral greatest common divisor 6. Integral product accumulation and subtraction 8. Reduction of an integral coefficient pair 5. Bounded integer coefficient policy configuration 8. Rational canonical-form inspection and coefficient component extraction 1. Exact scalar numerator and denominator extraction11
5. Checked coefficient overflow and result-policy dispatch UID: PPL-SPEC-000045 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, COEFF_CHECKED_I8, COEFF_CHECKED_I16, COEFF_CHECKED_I32, COEFF_CHECKED_I64 VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For a checked bounded coefficient profile, an ordinary coefficient arithmetic operation in 🔗 3. Exact ordinary integral coefficient arithmetic, or quotient calculation in 🔗 4. Coefficient quotient and remainder with truncation toward zero, whose exact integer result is outside the selected range shall throw std::overflow_error instead of returning a successful wrapped result. This includes negation of the least representable integer, endpoint-crossing increment or decrement, and dividing the least representable integer by -1. Operand prerequisites other than representability shall still apply.
After a supported arithmetic overflow exception, a surviving coefficient object shall remain destructible and assignable to a new representable value. Its previous value shall not be promised to remain unchanged. A constructor that throws shall not produce a usable object. Exception-message text shall not be prescribed. These promises shall not extend overflow checking to a native coefficient profile or promise rejection of a zero divisor.
For checked profiles, Bounded_Integer_Coefficient_Policy::handle_result(r) shall return normally exactly when result_overflow(r) is zero and result_class(r) differs from VC_NAN. Otherwise it shall dispatch to throw_result_exception(r). Supported positive/negative overflow codes, including unknown intermediate overflow, shall produce std::overflow_error. V_NAN and V_CVT_STR_UNK shall produce std::domain_error. A normally returned inexact result classification shall not be reclassified as exact.
RATIONALE: Checked bounded storage must detect arithmetic range loss while retaining a usable failure state. Its result handler distinguishes overflow and invalid-number classes from ordinary precision relations.
INTERFACE: Public header: <ppl.hh>. In a checked coefficient configuration:
struct Bounded_Integer_Coefficient_Policy { static void handle_result(Result r); };
The arithmetic call forms are specified by 🔗 3. Exact ordinary integral coefficient arithmetic and 🔗 4. Coefficient quotient and remainder with truncation toward zero. The policy operation shall be a static member.
VERIFICATION_CRITERIA: For each checked width, cross both range boundaries with addition, subtraction, multiplication, unary negation and increment/decrement. Require the exact exception category, then explicitly reassign and reuse surviving outputs without inspecting a promised old payload. Exercise accepted normal classifications, both signed overflow classes, invalid numeric input and unknown intermediate overflow. Cover all short-circuit outcomes in the policy handler.
SOURCE: src/Coefficient_types.hh; src/Coefficient_inlines.hh; src/Checked_Number.cc; tests/coefficient2.cc.
-
8. Coefficient scaling and truncated division by powers of two UID: PPL-SPEC-000048 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a live finite coefficient with entry value a and an unsigned exponent e, successful mul_2exp_assign(x, y, e) shall assign a2e to x, where a is y's entry value. Successful div_2exp_assign(x, y, e) shall assign trunc(a ⁄ 2e) to x. Truncation shall be toward zero for either sign. The exponent zero shall preserve the input value.
The destination may be the source itself. A distinct source shall remain unchanged. A successful bounded multiplication result shall be representable. For native bounded multiplication, the exponent shall additionally be less than the selected width. These conditions shall include multiplying -1 by the power whose exponent is one less than that width, producing the least representable integer without undefined intermediate signed overflow.
Bounded division shall admit every unsigned int exponent; an exponent at least as large as the coefficient width shall produce zero. Checked bounded multiplication shall also admit every such exponent: a zero source shall produce zero, while a nonzero source with an exponent at least as large as the width shall report overflow. The mpz profile shall admit the unsigned int exponent range subject to available computational resources.
Checked bounded multiplication whose result is outside the coefficient range, with other input prerequisites satisfied, shall report std::overflow_error and retain the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. Native bounded operations shall not promise overflow detection. The initialized-thread and synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply.
RATIONALE: Scaling by powers of two is an integer operation, including at the negative range boundary. A representable result must not be invalidated by an overflowing signed intermediate. Division must retain the same truncation convention as ordinary integer quotient calculation.
INTERFACE: Public header: <ppl.hh>. For Coefficient operands in Parma_Polyhedra_Library, the selected provider shall admit:
void mul_2exp_assign(Coefficient& x, const Coefficient& y, unsigned int exp); void div_2exp_assign(Coefficient& x, const Coefficient& y, unsigned int exp);
For a bounded profile these callable forms are supplied by function-template instantiations for the configured coefficient type.
VERIFICATION_CRITERIA: Check zero and nonzero exponents, positive and negative inputs, zero values, destination/source aliasing and preservation of distinct sources. Include the negative sign-bit boundary in every bounded width, multi-limb GMP values, and literal signed-division answers. Compare checked positive and negative overflow with the required exception and explicitly reassign surviving outputs. Run native valid-result cases under undefined-behavior sanitization and confirm that introducing an overflowing signed intermediate is detected by the boundary regression.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh: GMP helpers. src/Checked_Number_inlines.hh: bounded coefficient helper dispatch. src/checked_int_inlines.hh: bounded scaling and division. tests/coefficient2.cc: configured dyadic arithmetic and boundary cases.
-
4. Floating-to-integral range detection and reusable destinations UID: PPL-SPEC-000244 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For the admitted types and valid hardware prerequisites in 🔗 1. Supported finite native floating-to-integral scalar conversion, let q be the requested floor, ceiling or truncated integer defined by 🔗 2. Directed finite floating-to-integral rounding within range and 🔗 3. Delegated floating-to-integral truncation and exactness requests. If q lies below the destination minimum, ROUND_UP shall store that minimum and return V_LT_INF; ROUND_DOWN or ROUND_IGNORE shall return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE. If q lies above the maximum, ROUND_DOWN shall store that maximum and return V_GT_SUP; ROUND_UP or ROUND_IGNORE shall return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE. An optional strict flag shall not change these range outcomes.
A requested integer within range shall follow the ordinary classifications of 🔗 2. Directed finite floating-to-integral rounding within range and 🔗 3. Delegated floating-to-integral truncation and exactness requests. Checking range shall not itself require an undefined native floating-to-integer cast, including when a floating source format cannot represent the destination's maximum integer exactly. A failed range request shall not report a wrapped integer as successful. An unrepresentable result shall leave the destination assignable and destructible without a payload-value guarantee. ROUND_NOT_NEEDED shall exclude out-of-range inputs. These result codes shall be returned directly without automatic policy exception dispatch.
RATIONALE: Safe conversion must guard the actual requested integer range before any narrowing native cast. A finite source can exceed a destination bound even when the source format rounds that bound to a different floating value.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source and destination types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use unbounded dyadic oracles for every signed/unsigned endpoint and neighboring representable floating values. Include the largest source-representable integer inside each destination, the first outside it, large finite source maxima and negative values targeting unsigned storage. Require exact range codes, inward endpoints, outward flags, reusable outputs and no undefined-behavior sanitizer findings under valid hardware modes.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingtointegerspec1.cc.
-
5. Integral scalar conversion range outcomes UID: PPL-SPEC-000165 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a native integral, checked integral or mpz_class source, a native integral or Checked_Number<T, Check_Overflow_Policy<T>> destination shall detect a source integer outside its full native T range. The native source and destination types shall be those in 🔗 1. Exact conversion between native and checked integral scalars . This shall be a Result -returning conversion; an arithmetic range failure shall not invoke handle_result or throw an overflow exception automatically.
If the source is below the destination minimum, ROUND_UP shall store that minimum and return V_LT_INF . ROUND_DOWN or ROUND_IGNORE shall return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE . If the source is above the destination maximum, ROUND_DOWN shall store that maximum and return V_GT_SUP . ROUND_UP or ROUND_IGNORE shall return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE . An optional strict-relation flag shall not change these range outcomes.
An unrepresentable result shall not promise a meaningful destination payload; the destination shall remain assignable and destructible. ROUND_NOT_NEEDED shall require an exact representable result and shall therefore exclude these out-of-range requests, with or without a strict flag. These guarantees shall not extend to a Checked_Number destination whose policy disables overflow checking. The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage.
RATIONALE: A checked conversion returning Result must expose both the safe inward endpoint and the inability to represent the outward bound. It must allow its caller to choose subsequent policy handling.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above; To shall be an admitted native or checked destination type.
VERIFICATION_CRITERIA: Generate integers immediately outside every checked signed/unsigned range using an unbounded oracle. For native and checked integral sources, test each type pair whenever the source can represent the out-of-range value; also use mpz sources for every endpoint. Verify exact result codes, inward stored endpoints, unrepresentability flags, lack of automatic exception dispatch and reusable outputs.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc .
-
6. Rational conversion at and beyond integral endpoints UID: PPL-SPEC-000166 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a finite canonical rational source and a native or checked integral destination from 🔗 1. Exact conversion between native and checked integral scalars , assign_r shall distinguish a representable directed or truncated integer from range failure without policy-handler dispatch. Canonical representation shall follow 🔗 1. Exact rational assignment from rational and integral sources .
If truncating the rational toward zero already lies below or above the destination range, the conversion shall return the corresponding range outcome specified in 🔗 5. Integral scalar conversion range outcomes for the requested base direction. If that truncation lies within range but subsequent upward rounding would increase the maximum, it shall return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE . If subsequent downward rounding would decrease the minimum, it shall return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE . These shall not be reported as successful wrapped integers.
Representable rounded values shall follow 🔗 3. Directed rational-to-integral conversion within range or 🔗 4. Truncated rational-to-integral conversion and lazy relation requests , including a rational just beyond an endpoint whose requested integer rounds inward to that endpoint. An unrepresentable outcome shall preserve destination assignability and destructibility without a payload value promise. ROUND_NOT_NEEDED shall admit only exact representable integer results. A Checked_Number destination whose policy disables overflow checking shall remain outside this range-detection guarantee. The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage. Rational-source conversions shall use thread-local temporary storage in a thread-safe build; callers shall serialize those conversions across threads in a non-thread-safe build.
RATIONALE: Fractional endpoint crossings can fail during the directed increment or decrement even when the truncated quotient fits. They differ from a quotient already outside the destination range.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above; From shall be mpq_class and To an admitted native or checked destination type.
VERIFICATION_CRITERIA: Use exact thirds and halves immediately inside and outside every signed and unsigned endpoint, plus integral and fractional values more than one unit beyond it. Compare quotient/remainder-derived range cases and exact returned flags, both directed signs and strict requests; check valid unflagged lazy truncation separately. Require inward endpoint values and reusable outputs while preserving source components.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc .
-
2. Coefficient negation and absolute-value assignment UID: PPL-SPEC-000052 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For live finite coefficients with source entry value a, neg_assign(x, y) shall assign − a and abs_assign(x, y) shall assign |a|, where y supplies a. The one-argument forms shall apply the same operation to the destination's own entry value. The two-argument destination may be the source itself.
A successful bounded result shall be representable. In checked profiles, negating or taking the absolute value of the least representable integer shall report std::overflow_error and retain the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. A native bounded caller shall satisfy the representability precondition.
The initialized-thread and object-synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Distinct source objects shall remain unchanged. The mpz profile shall be subject to available computational resources.
RATIONALE: Named assignments must retain the same mathematical sign conventions as ordinary coefficient arithmetic, including supported in-place use.
INTERFACE: Public header: <ppl.hh>. The selected coefficient provider shall admit:
void neg_assign(Coefficient& x); void neg_assign(Coefficient& x, const Coefficient& y); void abs_assign(Coefficient& x); void abs_assign(Coefficient& x, const Coefficient& y);
Bounded forms shall be the corresponding function-template instantiations.
VERIFICATION_CRITERIA: Check all four forms for zero and both signs, explicit two-argument self-aliasing, preservation of a distinct source, and large GMP values. Check bounded endpoint-adjacent results and require overflow exceptions for both checked MIN operations, then reassign surviving outputs.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/coefficient4.cc.
-
Incoming link from: 2. Checked named remainder and exact quotient1
3. Coefficient remainder assignment and exact division UID: PPL-SPEC-000053 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For source entry values a and nonzero b, rem_assign(x, y, z) shall assign r = a − btrunc(a ⁄ b), where y supplies a and z supplies b. A nonzero remainder shall have the dividend's sign and satisfy |r| < |b|. This shall admit the bounded minimum divided by -1 and assign zero without requiring a representable quotient.
exact_div_assign(x, y, z) shall require nonzero b and exact divisibility of a by b. On success it shall assign a ⁄ b. The quotient shall be representable for successful bounded use. A checked quotient outside that range shall report std::overflow_error with the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. No invalid divisor or nondivisibility rejection shall be promised.
For either operation the destination may be either source, including when both sources denote the same nonzero object; calculations shall use entry values.
The initialized-thread and object-synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Distinct source objects shall remain unchanged. The mpz profile shall be subject to available computational resources.
RATIONALE: Exact division has a stronger input precondition than truncated quotient calculation. An explicit remainder assignment must preserve the already defined signed convention even where the corresponding bounded quotient cannot be represented.
INTERFACE: Public header: <ppl.hh>. For operands satisfying the respective preconditions, the selected provider shall admit:
void rem_assign(Coefficient& x, const Coefficient& y, const Coefficient& z); void exact_div_assign(Coefficient& x, const Coefficient& y, const Coefficient& z);
The bounded forms shall be function-template instantiations.
VERIFICATION_CRITERIA: Check every dividend/divisor sign combination, exact and inexact remainders, zero dividends and unit divisors against literal or unbounded answers. Exercise separate output, dividend alias, divisor alias and all-same nonzero arguments. Check MIN remainder -1 and checked MIN exact division by -1 separately.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/coefficient4.cc.
-
4. Coefficient greatest common divisor and least common multiple UID: PPL-SPEC-000054 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For live finite source entry values a and b, gcd_assign(x, y, z) shall assign the nonnegative greatest common divisor g. It shall assign zero for two zero sources and |a| when the other source is zero. lcm_assign(x, y, z) shall assign zero if either source is zero; otherwise it shall assign the positive least common multiple |a ⁄ g| |b|.
The destination may be either source, and the two sources may be the same object. Each calculation shall use their entry values. A successful bounded result shall be representable. For native bounded least-common-multiple calculation with two nonzero sources, both source absolute values shall additionally be representable. Native intermediate arithmetic shall be representable; in particular, no overflow shall be required to form a representable result.
In checked profiles, an unrepresentable nonnegative divisor or multiple, or an unrepresentable intermediate absolute value, shall report std::overflow_error with the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. The zero-multiple case shall not require taking the absolute value of a nonzero source.
The initialized-thread and object-synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Distinct source objects shall remain unchanged. The mpz profile shall be subject to available computational resources.
RATIONALE: Nonnegative normalization removes sign ambiguity, while explicit zero and alias rules make these common divisor primitives usable by reduction algorithms.
INTERFACE: Public header: <ppl.hh>. The selected coefficient provider shall admit:
void gcd_assign(Coefficient& x, const Coefficient& y, const Coefficient& z); void lcm_assign(Coefficient& x, const Coefficient& y, const Coefficient& z);
Bounded forms shall be function-template instantiations.
VERIFICATION_CRITERIA: Check zeros, every sign combination, coprime and noncoprime inputs, equal inputs and all destination/source alias arrangements. Verify literal expected answers and divisibility with an unbounded oracle. Include large GMP values, representable bounded MIN gcd results, zero LCM with MIN, and checked positive-range overflow.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; src/checked_inlines.hh; tests/coefficient4.cc.
-
Incoming link from: 1. Bounded native integer Bezout assignment1
5. Extended integral greatest common divisor UID: PPL-SPEC-000055 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For live finite source entry values a and b, successful gcdext_assign(g, s, t, a, b) shall assign the nonnegative greatest common divisor to g and integer coefficients to s and t satisfying as + bt = g. For two zero inputs, g shall be zero; no particular Bezout coefficients shall be required. Other cases shall also not prescribe a unique pair of Bezout coefficients.
The three output objects shall be pairwise distinct and shall be distinct from both source objects. The source objects may be the same object. This contract shall not admit other aliasing. All bounded output values and each evaluated Euclidean coefficient, quotient, product and difference shall be representable for successful bounded use. When the second source is nonzero, the absolute values of both bounded sources shall additionally be representable. When the second source is zero, the first absolute value shall be representable.
Checked unrepresentable source absolute-value acquisition shall report std::overflow_error with the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. This shall not promise that the unchecked native intermediate expressions within the extended Euclidean algorithm report overflow; the stated intermediate preconditions remain applicable in every bounded profile.
The initialized-thread and object-synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Distinct source objects shall remain unchanged. The mpz profile shall be subject to available computational resources.
RATIONALE: The Bezout identity is the portable result. Its coefficients need not coincide across backends, and multiple outputs require an explicit nonaliasing and intermediate-range contract.
INTERFACE: Public header: <ppl.hh>. The selected coefficient provider shall admit:
void gcdext_assign(Coefficient& g, Coefficient& s, Coefficient& t, const Coefficient& a, const Coefficient& b);
Bounded forms shall be the corresponding function-template instantiations.
VERIFICATION_CRITERIA: Check the Bezout identity using unbounded arithmetic, nonnegative gcd, zero combinations, equal and mixed-sign inputs, swapped inputs and coprime/noncoprime cases. Use small exhaustive bounded operands whose every algorithm intermediate is representable, plus large GMP inputs. Check checked MIN absolute-value failures and reassign all surviving outputs.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; src/checked_inlines.hh; tests/coefficient4.cc.
-
Incoming link from: 1. Native integer accumulated products and intermediate overflow1
6. Integral product accumulation and subtraction UID: PPL-SPEC-000056 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For destination and source entry values d, a and b, successful add_mul_assign(x, y, z) shall assign d + ab and successful sub_mul_assign(x, y, z) shall assign d − ab. The destination may be either or both sources, and the two sources may be the same object; each operand shall be interpreted at entry.
Successful bounded use shall require both the product ab and the final sum or difference to be representable. These shall be two arithmetic steps, with no promise of a wider fused accumulator. A checked overflow in either step shall report std::overflow_error with the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. This shall include an unrepresentable product whose addition to or subtraction from the destination could have cancelled into range: the operation may fail at that intermediate step. Native bounded callers shall satisfy both representability conditions.
The initialized-thread and object-synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Distinct source objects shall remain unchanged. The mpz profile shall be subject to available computational resources.
RATIONALE: Product accumulation is useful without an extra coefficient object, but a bounded two-step computation does not imply fused mathematical range.
INTERFACE: Public header: <ppl.hh>. The selected coefficient provider shall admit:
void add_mul_assign(Coefficient& x, const Coefficient& y, const Coefficient& z); void sub_mul_assign(Coefficient& x, const Coefficient& y, const Coefficient& z);
Bounded forms shall be function-template instantiations.
VERIFICATION_CRITERIA: Check zero, mixed signs, cancellation and all operand alias patterns with entry-value answers. Include multi-limb GMP products. For checked profiles separately overflow the product in both signs with positive, zero and negative destinations, and overflow only the final sum or difference. Require overflow also when a product overflow could have cancelled into range; reassign surviving outputs.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; src/checked_int_inlines.hh; tests/coefficient4.cc.
-
8. Reduction of an integral coefficient pair UID: PPL-SPEC-000058 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For finite source entry values a and b, not both zero, normalize2(x, y, n_x, n_y) shall assign a ⁄ g and b ⁄ g to the corresponding outputs, where g = gcd(a, b) > 0. It shall preserve each nonzero source's sign, produce a pair with greatest common divisor one, and preserve the ratio where defined.
The two outputs shall be distinct. n_x may be x and n_y may be y; other aliasing shall be excluded. For bounded successful use, the nonnegative gcd and both exact quotients shall be representable. Native intermediate arithmetic shall be representable. A checked gcd or quotient overflow shall report std::overflow_error with the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch.
The initialized-thread and object-synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Distinct source objects shall remain unchanged. The mpz profile shall be subject to available computational resources.
RATIONALE: Reduction is a simultaneous mathematical operation on entry values even when its corresponding outputs reuse the source objects.
INTERFACE: Internal interface declared in math_utilities_defs.hh within PPL:
void normalize2(Coefficient_traits::const_reference x, Coefficient_traits::const_reference y, Coefficient& n_x, Coefficient& n_y);
The trait's source parameter forms shall follow 🔗 1. Configured integral coefficient type and return trait.
VERIFICATION_CRITERIA: Check coprime and reducible pairs, every sign combination and one zero source. Verify literal normalized values, gcd one and exact reconstruction with an unbounded oracle. Exercise separate outputs, each permitted single alias and both permitted aliases. Check representable MIN/odd pairs and checked MIN/zero gcd overflow.
SOURCE: src/math_utilities_defs.hh and src/math_utilities_inlines.hh; tests/coefficient4.cc.
-
5. Bounded integer coefficient policy configuration UID: PPL-SPEC-000555 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, COEFF_CHECKED_I8, COEFF_CHECKED_I16, COEFF_CHECKED_I32, COEFF_CHECKED_I64, COEFF_NATIVE_I8, COEFF_NATIVE_I16, COEFF_NATIVE_I32, COEFF_NATIVE_I64 VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: In bounded integer coefficient configurations, Bounded_Integer_Coefficient_Policy shall provide true check_overflow, convertible and check_fpu_nan_result. Its has_nan, has_infinity and check_fpu_inexact shall be false, as shall check_inf_add_inf, check_inf_sub_inf, check_inf_mul_zero, check_div_zero, check_inf_div_inf, check_inf_mod and check_sqrt_neg. Each of the five rounding defaults listed in 🔗 2. Transparent numerical policy shall equal ROUND_NATIVE.
In checked bounded coefficient configurations, handle_result(r) shall invoke throw_result_exception(r) exactly when result_overflow(r) is true or result_class(r) == VC_NAN, with the categories of 🔗 8. Exception classification of numerical result codes. Otherwise it shall return without throwing. The overflow query shall have the code-sensitive meaning specified by 🔗 3. Overflow-sign and storage-representability result queries, including its treatment of annotated normal-class codes and class-based infinity signs. Checked coefficient operations shall retain the failure guarantees of 🔗 5. Checked coefficient overflow and result-policy dispatch. In unchecked native coefficient configurations, the policy's declaration shall not confer checked arithmetic behavior on the configured native Coefficient type or promise a linkable handler implementation.
RATIONALE: The configured coefficient profile determines the arithmetic and handler that are available. A policy declaration shared with native profiles shall not imply overflow protection for those native coefficients.
INTERFACE: Public header: <ppl.hh>; policy in PPL for bounded configurations:
struct Bounded_Integer_Coefficient_Policy; static void handle_result(Result result);
The named boolean traits and rounding defaults shall be constant policy members. Direct handler calls shall be admitted only in checked bounded coefficient configurations.
VERIFICATION_CRITERIA: Check all traits and five defaults in every checked and unchecked bounded profile. In checked profiles, pass ordinary relations, infinities, bounded overflow and NaN-class diagnostics to the handler, with and without the unrepresentability flag. Confirm the selected exception categories and ordinary return paths. Compile GMP configurations without referring to this bounded-only declaration, and do not call its handler in native profiles.
SOURCE: src/Coefficient_types.hh; src/Coefficient_inlines.hh; tests/numericpoliciesspec1.cc.
-
8. Exception classification of numerical result codes UID: PPL-SPEC-000128 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: throw_result_exception(r) shall always throw a standard exception and shall not return normally. It shall first ignore V_UNREPRESENTABLE for exception classification. V_EMPTY and the invalid-operation diagnostics V_NAN, V_CVT_STR_UNK, V_DIV_ZERO, V_INF_ADD_INF, V_INF_DIV_INF, V_INF_MOD, V_INF_MUL_ZERO, V_INF_SUB_INF, V_MOD_ZERO and V_SQRT_NEG shall produce std::domain_error.
V_EQ_MINUS_INFINITY, V_GT_MINUS_INFINITY, V_LT_INF, V_EQ_PLUS_INFINITY, V_LT_PLUS_INFINITY, V_GT_SUP, V_UNKNOWN_NEG_OVERFLOW and V_UNKNOWN_POS_OVERFLOW shall produce std::overflow_error. The ordinary nonempty relation results V_EQ, V_LT, V_LE, V_GT, V_GE, V_NE and V_LGE shall produce std::logic_error. An otherwise unrecognized result encoding shall also produce std::logic_error. Exception-message text shall not be prescribed.
This function shall classify the supplied code; it shall not reexecute an arithmetic operation or require initialized library state. Calling it on an ordinary relation code shall still throw, even when that code describes a successful numerical result.
RATIONALE: Exception dispatch is deliberately total over supplied result codes. Its classification of NaN-class intermediate overflow differs from a simple overflow-sign query and must be explicit.
INTERFACE: Public header: <ppl.hh>; PPL declaration:
[[noreturn]] void throw_result_exception(Result r);
VERIFICATION_CRITERIA: Check each named result against a literal exception-category table, both with and without the unrepresentable flag. Require a thrown exception of the intended standard category, distinguish overflow_error from its runtime_error base, and cover the unrecognized-code default. Do not constrain diagnostic wording.
SOURCE: src/Checked_Number_defs.hh and src/Checked_Number.cc; tests/numericprotocols1.cc.
-
1. Exact scalar numerator and denominator extraction UID: PPL-SPEC-000919 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For a finite native integer, mpz_class, supported native floating value, or admitted Checked_Number scalar, numer_denom(from, numer, denom) shall obtain the source's exact rational value n ⁄ d in canonical form and assign n to numer followed by positive d to denom. The components shall be coprime. An integral source shall give its exact integer and denominator one; either sign of native zero shall give zero and one. Native floating values shall be interpreted as their exact binary values. Raw mpq_class extraction shall remain governed by 🔗 8. Rational canonical-form inspection and coefficient component extraction; a checked rational source here shall have a finite canonical payload under 🔗 1. Exact rational assignment from rational and integral sources. Supported floating-source availability and conversion prerequisites shall follow 🔗 2. Exact rational assignment of finite native floating-point values.
The output coefficient objects shall be distinct. When types permit, one output may designate the complete integral source value, including the whole integral raw value owned by a checked source. Both outputs shall then use the source's entry value, copied before either assignment. Outputs shall not designate proper numerator/denominator subobjects of rational source storage. A source disjoint from the output objects shall remain unchanged, including its floating sign of zero and rational component representation.
Both components shall fit the configured coefficient range for an unchecked bounded coefficient profile. A checked bounded profile shall report unrepresentable components through the configured coefficient assignment policy and its std::overflow_error in 🔗 5. Checked coefficient overflow and result-policy dispatch. A failure assigning the denominator may follow a completed numerator assignment; there shall be no two-output rollback promise. Surviving outputs shall retain that assignment's valid-reuse and destruction guarantees. Unbounded coefficient storage shall impose no fixed component range. Allocation and other escaping exceptions shall retain the underlying operations' guarantees.
The helper shall return void. It shall not require rounding defaults or a handler from a checked source policy, or invoke that source policy's handler. Assignment to the configured coefficient outputs shall retain their own policy behavior. Objects and borrowed source values shall remain live; access shall be synchronized against overlapping modification. With a non-thread-safe build, callers shall serialize operations using shared PPL temporary storage; a thread-safe build shall provide independent per-thread temporaries. No library/thread initialization or coefficient- constant stage shall be required. Available resources shall limit temporary rational storage. The current hardware rounding direction shall be preserved.
RATIONALE: Constructing exact constraints from scalar values requires canonical integer components without first rounding the value to a configured coefficient.
INTERFACE: Internal header: math_utilities_defs.hh; function template in Parma_Polyhedra_Library, for the source families above:
template <Native_Or_Checked_Number T> void numer_denom(const T& from, Coefficient& numer, Coefficient& denom);
VERIFICATION_CRITERIA: Check literal integral/GMP components and independent binary-significand floating oracles, both signs and signed zeros, canonical rational wrappers, source-policy capability without defaults/handlers and exact void return. Exercise actual coefficient ranges, first- and second-output checked overflow, valid reuse, borrowed integral source aliases and independent outputs. Verify source representation and hardware-mode preservation; cover actual disabled floating support without instantiating unavailable source conversions.
SOURCE: src/math_utilities_defs.hh; src/math_utilities_inlines.hh; tests/scalarcomponentsspec1.cc.
-
1. Numerical and geometric foundations UID: PPL-HLR-000001 STATUS: APPROVED COMPONENT: LIBRARY_WIDE APPLICABILITY: ALL VERIFICATION_METHODS: Test, Analysis, Review RELATIONS (Child): - PPL-LLR-000446 Reloadable textual representations (Refined by)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Refined by)
- PPL-LLR-000012 Affine meaning of linear expressions (Refined by)
- PPL-LLR-000013 Meaning of linear constraints (Refined by)
- PPL-LLR-000014 Meaning of linear congruences (Refined by)
- PPL-LLR-000015 Distinct meanings of geometric generators (Refined by)
- PPL-LLR-000001 Exact integral coefficient calculations (Refined by)
- PPL-LLR-000002 Detection of checked coefficient overflow (Refined by)
- PPL-LLR-000003 Conservative directed numerical bounds (Refined by)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Refined by)
- PPL-LLR-000414 Integer quotient and remainder semantics (Refined by)
- PPL-LLR-000415 Exact rational arithmetic (Refined by)
STATEMENT: PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.
RATIONALE: Domains and solvers need a common interpretation of coefficients, coordinates, expressions, constraints and generators.
VERIFICATION_CRITERIA: Review the common mathematical definitions and their consistency across domains; exercise representative descriptor construction, arithmetic and dimension changes under each supported numerical configuration.
BIBLIOGRAPHY: BagnaraHZ08SCP | Whole work (background on the library's numerical abstractions and design).
SOURCE: doc/definitions.dox: Basic_Geometric_Descriptors, Syntactic_Geometric_Descriptors; src/Coefficient_defs.hh; src/Linear_Expression_defs.hh.
- PPL-SPEC-001142 Rectilinear distance of bounded-difference closed-bound tables (Specified by)
- PPL-SPEC-001143 Euclidean distance of bounded-difference closed-bound tables (Specified by)
- PPL-SPEC-001144 Maximum-coordinate distance of bounded-difference closed-bound tables (Specified by)
- PPL-SPEC-001145 Bounded-difference distance normalization, boundaries and workspaces (Specified by)
- PPL-SPEC-001052 Rectilinear distance between Box endpoint tuples (Specified by)
- PPL-SPEC-001053 Euclidean distance between Box endpoint tuples (Specified by)
- PPL-SPEC-001054 Maximum-coordinate distance between Box endpoint tuples (Specified by)
- PPL-SPEC-001197 Complete checked-wrapper placement construction without a handler (Specified by)
- PPL-SPEC-000754 Pointwise upward matrix conversion (Specified by)
- PPL-SPEC-000767 Rectilinear distance between bound-entry arrays (Specified by)
- PPL-SPEC-000768 Euclidean distance between bound-entry arrays (Specified by)
- PPL-SPEC-000769 Maximum-coordinate distance between bound-entry arrays (Specified by)
- PPL-SPEC-000657 Pointwise upward conversion of extended-number rows (Specified by)
- PPL-SPEC-000521 Finite native floating addition of an accumulated product (Specified by)
- PPL-SPEC-000522 Finite native floating subtraction of an accumulated product (Specified by)
- PPL-SPEC-000523 Configured native accumulation precision and truthful result relations (Specified by)
- PPL-SPEC-000481 Finite native floating-point addition and subtraction (Specified by)
- PPL-SPEC-000482 Finite native floating-point multiplication (Specified by)
- PPL-SPEC-000483 Finite native floating-point division by a nonzero value (Specified by)
- PPL-SPEC-000484 Rounding, result classes and state for finite native binary arithmetic (Specified by)
- PPL-SPEC-000202 Directed conversion to adjacent finite normal floating-point bounds (Specified by)
- PPL-SPEC-000203 Directed conversion in the subnormal and underflow range (Specified by)
- PPL-SPEC-000205 Floating conversion overflow thresholds and computed-value classes (Specified by)
- PPL-SPEC-000504 Finite native addition and subtraction of a power of two (Specified by)
- PPL-SPEC-000505 Finite native multiplication and division by a power of two (Specified by)
- PPL-SPEC-000506 Truncated native floating quotient before storage rounding (Specified by)
- PPL-SPEC-000509 Rounded nonnegative native residue modulo a power of two (Specified by)
- PPL-SPEC-000242 Directed finite floating-to-integral rounding within range (Specified by)
- PPL-SPEC-000244 Floating-to-integral range detection and reusable destinations (Specified by)
- PPL-SPEC-000163 Directed rational-to-integral conversion within range (Specified by)
- PPL-SPEC-000166 Rational conversion at and beyond integral endpoints (Specified by)
- PPL-SPEC-000341 Directed native integral conversion to native floating-point storage (Specified by)
- PPL-SPEC-000344 Directed narrowing between finite native floating-point formats (Specified by)
- PPL-SPEC-000346 Range limits in conversion of finite native scalars to floating point (Specified by)
- PPL-SPEC-000832 Directed native integer division and delegated truncation (Specified by)
- PPL-SPEC-000838 Directed native integer division by powers of two (Specified by)
- PPL-SPEC-000840 Directed native integer square-root assignment (Specified by)
- PPL-SPEC-000124 Rounding-direction intent, composition and inspection (Specified by)
- PPL-SPEC-000125 Inversion of a supported rounding bound direction (Specified by)
- PPL-SPEC-000126 Mapping a bound direction to the platform FPU encoding (Specified by)
- PPL-SPEC-000527 Numeric text input into integral destinations (Specified by)
- PPL-SPEC-000528 Numeric text input into supported native floating destinations (Specified by)
- PPL-SPEC-001230 Octagonal distance normalization, boundaries and workspaces (Specified by)
- PPL-SPEC-001231 Rectilinear distance of octagonal closed-bound tables (Specified by)
- PPL-SPEC-001232 Euclidean distance of octagonal closed-bound tables (Specified by)
- PPL-SPEC-001233 Maximum-coordinate distance of octagonal closed-bound tables (Specified by)
- PPL-SPEC-000774 Pointwise upward representation conversion (Specified by)
- PPL-SPEC-000796 Rectilinear distance of physical octagonal entry arrays (Specified by)
- PPL-SPEC-000797 Euclidean distance of physical octagonal entry arrays (Specified by)
- PPL-SPEC-000798 Maximum-coordinate distance of physical octagonal entry arrays (Specified by)
- PPL-SPEC-000799 Distance workspace protocol and admissible overlaps (Specified by)
- PPL-SPEC-001641 Weakly relational extended-number policies (Specified by)
- PPL-SPEC-001642 Interval and scalar view adapters (Specified by)
- PPL-SPEC-001643 Borrowed or converted distance operands (Specified by)
- PPL-SPEC-000501 Directed and delegated square root of a finite native value (Specified by)
- PPL-SPEC-000502 Finite rational square root at the selected irrational precision (Specified by)
- PPL-SPEC-000503 Selection and ownership of irrational rational precision (Specified by)
- PPL-SPEC-000513 Directed unbounded integer division and explicit delegated convention (Specified by)
- PPL-SPEC-000515 Unbounded integer arithmetic with powers of two (Specified by)
- PPL-SPEC-000262 Directed canonical rational conversion to an unbounded integer (Specified by)
- PPL-SPEC-000264 Directed finite native floating-point conversion to mpz storage (Specified by)
- PPL-SPEC-001196 Finite native floating-point placement construction of an unbounded integer (Specified by)
- PPL-SPEC-000519 Directed unbounded integer square roots (Specified by)
When a supported numerical operation promises a downward or upward bound on a defined real result, a successful downward-bound result shall not exceed that result and a successful upward-bound result shall not be less than it.
Directed numerical bounds are the foundation of sound interval and weakly relational approximations. The guarantee is conditional on the operation and numeric policy supporting the requested direction.
Verification covers directed arithmetic and bound-producing conversions, distinguishing their supported directions and profiles. Related obligations: 🔗 14. Directional bounds, extrema and attainment, 🔗 1. Meaning of successful exact and approximate results.
Compare directed results with exact rational or independently established high-precision results. Include inexact values, cancellation, subnormal values where supported, range boundaries and admitted infinite bounds. Check both directions separately.
src/Rounding_Dir_defs.hh: rounding directions. src/checked_defs.hh: checked arithmetic and conversions. src/checked_float_inlines.hh: directed floating-point operations. src/WRD_coefficient_types_defs.hh: extended-number policies.
-
1. Rectilinear distance of bounded-difference closed-bound tables UID: PPL-SPEC-001142 STATUS: APPROVED COMPONENT: BOUNDED_DIFFERENCES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000051 Bounded-difference expressiveness (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: Under 🔗 4. Bounded-difference distance normalization, boundaries and workspaces, the three rectilinear_distance_assign overloads shall assign the requested directed approximation of the distance between the selected closed bound tables of their dimension-compatible operands. If both shapes are nonempty, corresponding finite bounds shall contribute dij = |bij(X) − bij(Y)|. Two positive-infinite entries shall contribute zero; exactly one positive infinity at any corresponding position shall make the distance positive infinity.
For finite corresponding differences, the exact distance shall be ∑i ≠ jdij, with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001145].
On successful numerical completion the operation shall return true. An upward result shall not be smaller than the exact selected-table distance and a downward result shall not be larger. A true Boolean shall not imply exactness or the best representable rounded bound. Valid inexact conversions to the selected temporary type shall retain these directed guarantees. The accumulation and finalization shall retain 🔗 17. Rectilinear distance between bound-entry arrays.
RATIONALE: The sum of absolute corresponding bound changes compares the selected graph-bound descriptions while retaining an explicit mathematical meaning and numerical direction.
INTERFACE: Public header: <ppl.hh>; free functions in Parma_Polyhedra_Library:
template <typename To, typename T> bool rectilinear_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool rectilinear_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool rectilinear_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Compute primitive suprema independently from rational conjunctions and compare all three overload forms with exact bound-array norms. Include translated nonzero operands, signed differences, infinity positions, identical owners, zero/empty cases and incompatible dimensions. Exercise exact and inexact temporary/result conversions, admitted aliases and supported configurations; verify source preservation and caller rounding. For rectilinear results compare the independent sum of absolute entry differences, including translated operands and differently signed entries.
SOURCE: src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/bdshapedistancespec1.cc; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/bdshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.
-
Incoming link from: 4. Bounded-difference distance normalization, boundaries and workspaces1
2. Euclidean distance of bounded-difference closed-bound tables UID: PPL-SPEC-001143 STATUS: APPROVED COMPONENT: BOUNDED_DIFFERENCES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000051 Bounded-difference expressiveness (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: Under 🔗 4. Bounded-difference distance normalization, boundaries and workspaces, the three euclidean_distance_assign overloads shall assign the requested directed approximation of the distance between the selected closed bound tables of their dimension-compatible operands. If both shapes are nonempty, corresponding finite bounds shall contribute dij = |bij(X) − bij(Y)|. Two positive-infinite entries shall contribute zero; exactly one positive infinity at any corresponding position shall make the distance positive infinity.
For finite corresponding differences, the exact distance shall be √(∑i ≠ jd 2ij), with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001145].
On successful numerical completion the operation shall return true. An upward result shall not be smaller than the exact selected-table distance and a downward result shall not be larger. A true Boolean shall not imply exactness or the best representable rounded bound. Valid inexact conversions to the selected temporary type shall retain these directed guarantees. The accumulation and finalization shall retain 🔗 18. Euclidean distance between bound-entry arrays.
Rational square-root enclosure shall retain 🔗 2. Finite rational square root at the selected irrational precision and the calling precision of 🔗 3. Selection and ownership of irrational rational precision, which shall remain stable throughout the dependent call.
RATIONALE: The square root of the sum of squared bound changes compares the selected graph-bound descriptions while retaining an explicit mathematical meaning and numerical direction.
INTERFACE: Public header: <ppl.hh>; free functions in Parma_Polyhedra_Library:
template <typename To, typename T> bool euclidean_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool euclidean_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool euclidean_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Compute primitive suprema independently from rational conjunctions and compare all three overload forms with exact bound-array norms. Include translated nonzero operands, signed differences, infinity positions, identical owners, zero/empty cases and incompatible dimensions. Exercise exact and inexact temporary/result conversions, admitted aliases and supported configurations; verify source preservation and caller rounding. For Euclidean results compare exact rational squares and test rational precision, rather than using a rounded reference square root.
SOURCE: src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/bdshapedistancespec1.cc; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/bdshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.
-
3. Maximum-coordinate distance of bounded-difference closed-bound tables UID: PPL-SPEC-001144 STATUS: APPROVED COMPONENT: BOUNDED_DIFFERENCES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000051 Bounded-difference expressiveness (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: Under 🔗 4. Bounded-difference distance normalization, boundaries and workspaces, the three l_infinity_distance_assign overloads shall assign the requested directed approximation of the distance between the selected closed bound tables of their dimension-compatible operands. If both shapes are nonempty, corresponding finite bounds shall contribute dij = |bij(X) − bij(Y)|. Two positive-infinite entries shall contribute zero; exactly one positive infinity at any corresponding position shall make the distance positive infinity.
For finite corresponding differences, the exact distance shall be maxi ≠ jdij, with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001145].
On successful numerical completion the operation shall return true. An upward result shall not be smaller than the exact selected-table distance and a downward result shall not be larger. A true Boolean shall not imply exactness or the best representable rounded bound. Valid inexact conversions to the selected temporary type shall retain these directed guarantees. The accumulation and finalization shall retain 🔗 19. Maximum-coordinate distance between bound-entry arrays.
RATIONALE: The largest absolute corresponding bound change compares the selected graph-bound descriptions while retaining an explicit mathematical meaning and numerical direction.
INTERFACE: Public header: <ppl.hh>; free functions in Parma_Polyhedra_Library:
template <typename To, typename T> bool l_infinity_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool l_infinity_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool l_infinity_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Compute primitive suprema independently from rational conjunctions and compare all three overload forms with exact bound-array norms. Include translated nonzero operands, signed differences, infinity positions, identical owners, zero/empty cases and incompatible dimensions. Exercise exact and inexact temporary/result conversions, admitted aliases and supported configurations; verify source preservation and caller rounding. For maximum-coordinate results identify the exact greatest absolute entry difference independently and exercise both first and later maximum updates.
SOURCE: src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/bdshapedistancespec1.cc; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/bdshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.
-
4. Bounded-difference distance normalization, boundaries and workspaces UID: PPL-SPEC-001145 STATUS: APPROVED COMPONENT: BOUNDED_DIFFERENCES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000051 Bounded-difference expressiveness (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000303 Preservation by representation-only changes (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a nonempty shape of ambient dimension n, let z0 = 0 and zi = xi − 1 for 1 ≤ i ≤ n. Position (i, j) of its square bound table shall describe zj − zi ≤ bij. A positive-infinite bound shall impose no restriction. Distance tuples shall include every ordered off-diagonal position. Matching positive-infinite diagonal sentinels shall contribute zero.
The selected tables shall be those used after the call's required shortest-path normalization. When closure arithmetic is exact under its range prerequisites, finite entries shall be the primitive suprema of the represented set, with infinity for unbounded forms. Rounded or saturating closure shall retain 🔗 1. Bounded-difference values, numerical profiles and valid use; its tables need not be canonical, idempotent or invariant across alternative source descriptions. The distance shall be computed from the selected tables, as retained in compatible post-call records of 🔗 2. Reloadable bounded-difference record export, rather than being a point-set or Hausdorff distance. Normalization shall preserve each source's represented set and ambient dimension.
Different ambient dimensions shall return false before modifying the result or supplied workspaces. False shall assign no distance for that incompatible pair. Dimension-compatible two-empty shapes shall have distance zero; exactly one empty shape shall have positive-infinite distance. In dimension zero, two universe shapes shall also have distance zero. These rules shall apply to logically empty sources whose emptiness has not yet been classified. Equal dimensions shall return true on successful numerical completion, with the value specified by 🔗 1. Rectilinear distance of bounded-difference closed-bound tables, [LINK: PPL-SPEC-001143] or 🔗 3. Maximum-coordinate distance of bounded-difference closed-bound tables.
The overload without an explicit temporary type shall use three Checked_Number<To,Extended_Number_Policy> workspaces. The overload with an explicit scalar Temp argument shall instead use three Checked_Number<Temp,Extended_Number_Policy> workspaces. The supplied-workspace overload shall use the actual type of its three references, which may be an admitted raw or checked numeric type. The supported operation, rounding, representation and overlap conditions of 🔗 20. Distance scratch storage, admissible overlaps and numeric conditions shall apply to the selected metric specializations, subject to the public source-storage condition below.
Calls evaluating finite entry differences shall use ROUND_DOWN or ROUND_UP, optionally combined with ROUND_STRICT_RELATION. They shall not require finite source conversions to be exact merely to establish the requested directed bound. Paths performing only exact zero or positive-infinity assignments shall admit directions valid for those selected scalar assignments. An output profile shall support positive infinity whenever that outcome is reachable. Every conversion, difference, sum, square, square root and final assignment shall satisfy its selected backend's arithmetic, range, numerical-failure, resource, initialization and nontrapping prerequisites. Native arithmetic shall retain configured support and the initialized caller-owned FPU conditions; the call shall preserve caller rounding. Rational square-root precision shall remain stable throughout a dependent call.
Sources shall be live valid objects under 🔗 1. Bounded-difference values, numerical profiles and valid use. The same shape may be supplied for both operands. The three mutable supplied workspaces shall be live, pairwise distinct, and disjoint from source-owned storage. Their entry values need not be initialized when overwritten before reading. The result shall have live assignable storage disjoint from source-owned storage, but may overlap any one supplied workspace or its compatible underlying raw storage. When the result overlaps a workspace, its mathematical value shall still use source values on entry. No workspace entry value shall be required when overwritten before reading. Callers shall preserve object/storage lifetimes and synchronize source access, including logically const cache updates.
Numerical and recoverable resource failures shall retain their selected propagation channels and permitted partial result/workspace states; no aggregate rollback guarantee shall be inferred. Discarded owned temporaries shall be released, while reusable numerical cache storage shall retain its own lifetime and cleanup contract. Ordinary dimension mismatch shall retain the stronger unchanged-output/workspace guarantee above. Otherwise valid calls shall require no additional library initialization beyond their selected representation, numerical and thread runtime prerequisites.
RATIONALE: A bound-array metric needs an explicit normalization convention, source carrier and numeric protocol. Exact semantic support tuples and rounded representation tuples have different invariance properties, while their empty/dimension outcomes and storage obligations remain explicit.
INTERFACE: Public header: <ppl.hh>. This protocol applies to all nine free function overloads declared in 🔗 1. Rectilinear distance of bounded-difference closed-bound tables, 🔗 2. Euclidean distance of bounded-difference closed-bound tables and 🔗 3. Maximum-coordinate distance of bounded-difference closed-bound tables, in Parma_Polyhedra_Library. Their result, shape, rounding and optional three-workspace parameters retain those exact signatures.
template <typename Temp, typename To, typename T> bool rectilinear_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2); template <typename Temp, typename To, typename T> bool euclidean_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2); template <typename Temp, typename To, typename T> bool l_infinity_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const BD_Shape<T>& x, const BD_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Verify independent rational support closure, rounded selected-table norms and before/after denotation equality separately. Cover all nine forms, cold/classified/reduced histories, lazy emptiness, zero dimensions, one-sided infinities, mismatched dimensions and unchanged sentinels. Test same-owner inputs, result aliases to each raw/checked workspace, different temporary/result profiles, required initialized native modes and caller-mode preservation. Measure and exercise meaningful allocation/cleanup paths, distinguishing C++ new/new[] observation from backend GMP allocation failures.
BIBLIOGRAPHY: BagnaraHZ09FMSD | Section 3.1, difference constraints, unary zero-node encoding and transitive closure (PDF page index 5, zero-based).
SOURCE: src/BD_Shape_defs.hh; src/BD_Shape_inlines.hh; src/BD_Shape_templates.hh; src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/bdshapedistancespec1.cc; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/bdshapedistancepublic1.cc; tests/shapemetricboundaries1.cc; tests/bdshapedistancefailure1.cc; tests/boxallocationfixture.hh.
-
Incoming link from: 4. Box endpoint-distance domain, workspaces and dispatch1
1. Rectilinear distance between Box endpoint tuples UID: PPL-SPEC-001052 STATUS: APPROVED COMPONENT: INTERVALS_BOXES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000431 Mathematical query capabilities and logical outcomes (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
STATEMENT: For the endpoint differences dj of 🔗 4. Box endpoint-distance domain, workspaces and dispatch, rectilinear_distance_assign shall compute the requested directed bound on
D1(X, Y) = ∑jdj.This shall be a distance of endpoint descriptions, not the minimum distance between a point of each box. Openness shall not affect it. With exact rational temporary arithmetic and an exactly representable output, the finite sum shall be returned exactly.
The source interpretation, exceptional dimensional/empty/infinite cases, false-output preservation, numerical directions, workspace choices and lifetime conditions of 🔗 4. Box endpoint-distance domain, workspaces and dispatch shall apply to every overload. With supported arithmetic and representable intermediates, a completed upward result shall be at least the exact distance and a completed downward result at most the exact distance. A numerical or resource failure shall not establish a successful directed-bound result. Both sources shall retain their values and dimensions.
RATIONALE: Endpoint descriptions give a deterministic numerical comparison of boxes; its meaning differs from geometric point-to-set separation.
INTERFACE: Public header: <ppl.hh>; PPL free functions:
template <typename To, typename ITV> bool rectilinear_distance_assign( Checked_Number<To,Extended_Number_Policy>& result, const Box<ITV>& x, const Box<ITV>& y, Rounding_Dir dir); template <typename Temp, typename To, typename ITV> bool rectilinear_distance_assign( Checked_Number<To,Extended_Number_Policy>& result, const Box<ITV>& x, const Box<ITV>& y, Rounding_Dir dir); template <typename Work, typename To, typename ITV> bool rectilinear_distance_assign( Checked_Number<To,Extended_Number_Policy>& result, const Box<ITV>& x, const Box<ITV>& y, Rounding_Dir dir, Work& tmp0, Work& tmp1, Work& tmp2);
VERIFICATION_CRITERIA: Independently flatten rational product descriptions and sum their absolute finite endpoint differences. Check exact sums, both source orders, all three overload forms, supplied scratch/result overlaps, identical owners, open/closed descriptions with equal endpoints, unbounded positions, empty and zero-dimensional conventions, mismatch sentinels and directed native output bounds.
SOURCE: src/Box_defs.hh; src/Box_inlines.hh; src/Box_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/boxdistancesspec1.cc; tests/boxdistanceoracle.hh; tests/boxdistancespublic1.cc; tests/Box/intervalcontracts1.cc; tests/boxrationalmetrictemporaries1.cc.
-
Incoming link from: 4. Box endpoint-distance domain, workspaces and dispatch1
2. Euclidean distance between Box endpoint tuples UID: PPL-SPEC-001053 STATUS: APPROVED COMPONENT: INTERVALS_BOXES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000431 Mathematical query capabilities and logical outcomes (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
STATEMENT: For the endpoint differences dj of 🔗 4. Box endpoint-distance domain, workspaces and dispatch, euclidean_distance_assign shall compute the requested directed bound on
D2(X, Y) = √( ∑jd2j).Each squared contribution shall preserve the requested bound on this nonnegative endpoint distance, including when conversions into a temporary format are inexact. This endpoint-tuple norm shall not be identified with the minimum set distance or general Euclidean Hausdorff distance between the represented boxes. Openness shall not affect it. A rational temporary square root shall retain the enclosure and precision conditions of 🔗 2. Finite rational square root at the selected irrational precision and 🔗 3. Selection and ownership of irrational rational precision; no universal exactness of a rational perfect-square input or universal fixed error width shall be inferred beyond those contracts.
The source interpretation, exceptional dimensional/empty/infinite cases, false-output preservation, numerical directions, workspace choices and lifetime conditions of 🔗 4. Box endpoint-distance domain, workspaces and dispatch shall apply to every overload. With supported arithmetic and representable intermediates, a completed upward result shall be at least the exact distance and a completed downward result at most the exact distance. A numerical or resource failure shall not establish a successful directed-bound result. Both sources shall retain their values and dimensions.
RATIONALE: A directed bound on a sum of squares requires bounds on nonnegative contributions; squaring a negative lower approximation does not preserve that ordering.
INTERFACE: Public header: <ppl.hh>; PPL free functions:
template <typename To, typename ITV> bool euclidean_distance_assign( Checked_Number<To,Extended_Number_Policy>& result, const Box<ITV>& x, const Box<ITV>& y, Rounding_Dir dir); template <typename Temp, typename To, typename ITV> bool euclidean_distance_assign( Checked_Number<To,Extended_Number_Policy>& result, const Box<ITV>& x, const Box<ITV>& y, Rounding_Dir dir); template <typename Work, typename To, typename ITV> bool euclidean_distance_assign( Checked_Number<To,Extended_Number_Policy>& result, const Box<ITV>& x, const Box<ITV>& y, Rounding_Dir dir, Work& tmp0, Work& tmp1, Work& tmp2);
VERIFICATION_CRITERIA: Compute the exact rational sum of squared endpoint differences independently. Check directed results by exact squaring with the appropriate sign condition; include zero, Pythagorean and irrational norms, rational precision choices, inexact temporary conversions, matching/mismatching unbounded endpoints, all overloads and result/scratch overlaps, dimension mismatch and scalar range/resource prerequisites.
SOURCE: src/Box_defs.hh; src/Box_inlines.hh; src/Box_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/boxdistancesspec1.cc; tests/boxdistanceoracle.hh; tests/boxdistancespublic1.cc; tests/Box/intervalcontracts1.cc; tests/boxrationalmetrictemporaries1.cc.
-
Incoming link from: 4. Box endpoint-distance domain, workspaces and dispatch1
3. Maximum-coordinate distance between Box endpoint tuples UID: PPL-SPEC-001054 STATUS: APPROVED COMPONENT: INTERVALS_BOXES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000431 Mathematical query capabilities and logical outcomes (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
STATEMENT: For the endpoint differences dj of 🔗 4. Box endpoint-distance domain, workspaces and dispatch, l_infinity_distance_assign shall compute the requested directed bound on
D∞(X, Y) = maxjdj,with value zero for an empty finite endpoint tuple. Openness shall not affect this endpoint comparison. With exact rational temporary arithmetic and an exactly representable output, the finite maximum shall be returned exactly.
The source interpretation, exceptional dimensional/empty/infinite cases, false-output preservation, numerical directions, workspace choices and lifetime conditions of 🔗 4. Box endpoint-distance domain, workspaces and dispatch shall apply to every overload. With supported arithmetic and representable intermediates, a completed upward result shall be at least the exact distance and a completed downward result at most the exact distance. A numerical or resource failure shall not establish a successful directed-bound result. Both sources shall retain their values and dimensions.
RATIONALE: The largest endpoint displacement is a separate norm from the sum and sum-of-squares comparisons and needs its own infinity and zero conventions.
INTERFACE: Public header: <ppl.hh>; PPL free functions:
template <typename To, typename ITV> bool l_infinity_distance_assign( Checked_Number<To,Extended_Number_Policy>& result, const Box<ITV>& x, const Box<ITV>& y, Rounding_Dir dir); template <typename Temp, typename To, typename ITV> bool l_infinity_distance_assign( Checked_Number<To,Extended_Number_Policy>& result, const Box<ITV>& x, const Box<ITV>& y, Rounding_Dir dir); template <typename Work, typename To, typename ITV> bool l_infinity_distance_assign( Checked_Number<To,Extended_Number_Policy>& result, const Box<ITV>& x, const Box<ITV>& y, Rounding_Dir dir, Work& tmp0, Work& tmp1, Work& tmp2);
VERIFICATION_CRITERIA: Independently compute the maximum endpoint difference. Check exact rational and directed native results, ties, zero-contribution coordinates, every coordinate as unique maximum, source symmetry, all overloads and admitted scratch/result overlaps, equal endpoints with different openness, unbounded positions and dimension/empty conventions.
SOURCE: src/Box_defs.hh; src/Box_inlines.hh; src/Box_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/boxdistancesspec1.cc; tests/boxdistanceoracle.hh; tests/boxdistancespublic1.cc; tests/Box/intervalcontracts1.cc; tests/boxrationalmetrictemporaries1.cc.
-
6. Complete checked-wrapper placement construction without a handler UID: PPL-SPEC-001197 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For an admitted call to the result-returning free construct function with To = Checked_Number<T, Policy>, the destination shall denote suitably aligned storage sufficient for that complete wrapper, with no live complete wrapper occupying it. T shall be an admitted native integer, configured native floating format, mpz_class or mpq_class. A numerical source shall be live and initialized; a typed special marker shall have its existing marker meaning. Source storage shall not overlap the unconstructed destination. The selected source/destination policies, scalar conversion and rounding request shall satisfy their existing numerical, representation, resource, initialization, FPU and synchronization prerequisites.
On normal return, a complete destination wrapper and its owned scalar shall have begun their lifetimes. The wrapper shall admit destruction and subsequent supported assignment. The represented result and returned Result shall have the selected checked conversion or typed-special assignment meaning. A failure or unrepresentable result shall not promise a numerical payload that its result and policy do not otherwise define. The source shall be preserved. The free function shall apply its existing exactness-request translation and result check once, without invoking a policy result handler or requiring a constructor rounding default. Both deduced calls and calls that explicitly specify To and From shall have this meaning.
If conversion throws after an owned class scalar has been initialized, ordinary constructor unwinding shall destroy that scalar. No complete destination wrapper is returned from the failed construction. This rule shall not imply an allocation rollback guarantee for the containing row or a live wrapper that the caller must destroy after a failed constructor. Raw native/GMP construction routes and ordinary public wrapper constructors shall retain their existing contracts; in particular, this no-handler function shall not replace the result handling of an ordinary converting constructor.
RATIONALE: A raw scalar subobject construction does not itself start the enclosing non-implicit-lifetime checked wrapper. Constructing the complete wrapper centrally permits all free construction callers, including upward DB-row conversion, to use the intended wrapper type. A private no-handler entry keeps result-returning construction distinct from an ordinary converting constructor and gives initialized class members language-provided cleanup.
INTERFACE: Public header: <ppl.hh>; free functions in PPL, with the admitted destination restriction above. Existing enable conditions and overload selection remain.
template <typename To, typename From> Result construct(To& destination, const From& source, Rounding_Dir dir);
Internal private tagged construction and its checked-destination access helper implement the complete-object lifetime. They are not additional public constructors or new conversion-policy defaults.
VERIFICATION_CRITERIA: 1. Exercise numerical and typed-special free construction in aligned raw wrapper storage, both with deduction and explicit two-template arguments, using policies without rounding defaults or an available result handler. Check the returned relation/class, source preservation, supported replacement and destruction. Include native, MPZ and canonical MPQ scalar families. 2. Inspect the complete wrapper placement-new and the private constructor's live member access, one request translation and one result check. Verify that no destination member function is called before complete wrapper construction and that initialized class scalar cleanup is supplied on constructor failure. 3. Check upward row conversion with fresh coherent normal and fallback storage profiles, preserving numerical values and sources without an extra conversion handler. Check raw-native and raw-GMP construction results and their independent replacement and destruction behavior under their existing contracts.
SOURCE: src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/DB_Row_templates.hh; tests/checkedscalarsspec1.cc; tests/dbrowownedhistories1.cc.
-
4. Pointwise upward matrix conversion UID: PPL-SPEC-000754 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Cross-element-type construction shall create the same square dimension and an independent row at every source coordinate. Its entry conversion shall follow 🔗 7. Pointwise upward conversion of extended-number rows: finite successful conversions shall bound the exact source upward, exact representable values shall remain exact, and supported extended values shall retain their meanings. The source shall remain unchanged; an empty source shall yield an empty target. Source/target policies shall admit every requested conversion and rounding direction, including all intermediates. Failure shall follow 🔗 16. Incomplete matrix cleanup and operation-specific failure guarantees.
RATIONALE: Changing bound representation must round outward at each actual matrix coordinate rather than change row/column associations.
INTERFACE: Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.
template <typename U> explicit DB_Matrix(const DB_Matrix<U>& y);
VERIFICATION_CRITERIA: Compare signed rational cells with independent GMP ceilings for integral targets and exact same-value conversions for rational targets, including positive infinity, empty matrices and source preservation.
SOURCE: src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.
-
17. Rectilinear distance between bound-entry arrays UID: PPL-SPEC-000767 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: With admitted workspaces and numerical prerequisites of 🔗 20. Distance scratch storage, admissible overlaps and numeric conditions, this operation shall return false for unequal matrix dimensions, leaving the result and workspaces unchanged. For equal dimensions it shall return true and assign the requested directed approximation of the rectilinear entry-array distance ∑i, jdij, where dij is the absolute finite-value difference. Equal positive-infinite entries shall contribute zero; exactly one positive infinity at any coordinate shall make the distance positive infinity. Empty equal-dimensional matrices shall have distance zero. Negative infinities and NaN shall remain outside this metric domain.
The sum shall use the selected temporary/result profiles and rounding direction; a successful upward result shall bound the exact distance above and a downward result below. Matrix coordinates shall retain their values except where the supplied result overlaps an entry. Reported numerical/resource failures shall not be true results.
RATIONALE: Distances of raw stored bound arrays need explicit coordinate, infinity and rounding conventions independent of geometric-set distance.
INTERFACE: Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.
template <typename Temp, typename To, typename T> bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r, const DB_Matrix<T>& x, const DB_Matrix<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Compare independently computed rational rectilinear distances and directed bounds, symmetry, empty/dimension mismatch, shared/one-sided infinities and supported result overlaps.
SOURCE: src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.
-
18. Euclidean distance between bound-entry arrays UID: PPL-SPEC-000768 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: - With admitted workspaces and numerical prerequisites of
🔗 20. Distance scratch storage, admissible overlaps and numeric conditions, this operation shall return false for unequal matrix dimensions, leaving the result and workspaces unchanged. For equal dimensions it shall return true and assign the requested directed approximation of the Euclidean entry-array distance √(∑i, jd 2ij), where dij is the absolute finite-value difference. Equal positive-infinite entries shall contribute zero; exactly one positive infinity at any coordinate shall make the distance positive infinity. Empty equal-dimensional matrices shall have distance zero. Negative infinities and NaN shall remain outside this metric domain.
The square-root of the sum of squares shall use the selected temporary/result profiles and rounding direction; a successful upward result shall bound the exact distance above and a downward result below. Matrix coordinates shall retain their values except where the supplied result overlaps an entry. Reported numerical/resource failures shall not be true results.
For rational temporaries, square-root enclosure shall retain 🔗 2. Finite rational square root at the selected irrational precision and the calling context's precision of 🔗 3. Selection and ownership of irrational rational precision.
RATIONALE: Distances of raw stored bound arrays need explicit coordinate, infinity and rounding conventions independent of geometric-set distance.
INTERFACE: Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.
template <typename Temp, typename To, typename T> bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r, const DB_Matrix<T>& x, const DB_Matrix<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Compare independently computed rational Euclidean distances and directed bounds, symmetry, empty/dimension mismatch, shared/one-sided infinities and supported result overlaps.
SOURCE: src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.
-
19. Maximum-coordinate distance between bound-entry arrays UID: PPL-SPEC-000769 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: With admitted workspaces and numerical prerequisites of 🔗 20. Distance scratch storage, admissible overlaps and numeric conditions, this operation shall return false for unequal matrix dimensions, leaving the result and workspaces unchanged. For equal dimensions it shall return true and assign the requested directed approximation of the maximum-coordinate entry-array distance maxi, jdij, where dij is the absolute finite-value difference. Equal positive-infinite entries shall contribute zero; exactly one positive infinity at any coordinate shall make the distance positive infinity. Empty equal-dimensional matrices shall have distance zero. Negative infinities and NaN shall remain outside this metric domain.
The maximum shall use the selected temporary/result profiles and rounding direction; a successful upward result shall bound the exact distance above and a downward result below. Matrix coordinates shall retain their values except where the supplied result overlaps an entry. Reported numerical/resource failures shall not be true results.
RATIONALE: Distances of raw stored bound arrays need explicit coordinate, infinity and rounding conventions independent of geometric-set distance.
INTERFACE: Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.
template <typename Temp, typename To, typename T> bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r, const DB_Matrix<T>& x, const DB_Matrix<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Compare independently computed rational maximum-coordinate distances and directed bounds, symmetry, empty/dimension mismatch, shared/one-sided infinities and supported result overlaps.
SOURCE: src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.
-
Incoming links from: 4. Pointwise upward matrix conversion 4. Pointwise upward representation conversion2
7. Pointwise upward conversion of extended-number rows UID: PPL-SPEC-000657 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Upward-approximation construction shall require a preconstructed target, a constructed source, and an admitted capacity at least the source size. It shall produce the same logical size, independently owning a converted value at each source coordinate. Each successfully converted finite value shall be an upper bound on its exact source value under the selected conversion's supported ROUND_UP semantics; exactly representable conversions shall preserve that value. Admitted signed infinities shall retain their extended-number meaning.
Conversion shall preserve the source. Selected source/target policies shall support all requested values and rounding directions, with every arithmetic/resource precondition active. Empty constructed sources shall produce constructed empty targets. Recoverable failures shall follow 🔗 10. Row construction cleanup and recoverable failure states and shall not be reported as successful bounds.
RATIONALE: Changing the numeric representation of difference bounds must round outward coordinate by coordinate.
INTERFACE: Internal source header: DB_Row_defs.hh. Names belong to Parma_Polyhedra_Library. Member signatures apply to DB_Row<T>; iterator and memory aliases have their declared source types.
template <typename U> void construct_upward_approximation(const DB_Row<U>& y, dimension_type capacity);
VERIFICATION_CRITERIA: Compare signed rational inputs against independent GMP ceilings for integral targets and exact rational copies for rational targets, include both infinities and empty rows, and check source preservation.
SOURCE: src/DB_Row_defs.hh; src/DB_Row_inlines.hh; src/DB_Row_templates.hh; tests/dbrowspec1.cc; tests/dbrowlegacy1.cc; tests/dbrowallocation1.cc; tests/dbrowiteratorlaws1.cc; tests/dbrowownedhistories1.cc.
-
1. Finite native floating addition of an accumulated product UID: PPL-SPEC-000521 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The accumulator and both sources shall be live admitted same-format native or Checked_Number<F, Check_Overflow_Policy<F>> objects as in 🔗 4. Rounding, result classes and state for finite native binary arithmetic, with finite entry values z, a and b. add_mul_assign_r shall accumulate z + ab using the configured native multiply/add precision in 🔗 3. Configured native accumulation precision and truthful result relations. Its rounding request, result class/relation and hardware prerequisites shall follow 🔗 3. Configured native accumulation precision and truthful result relations. A directed result shall bound the exact real expression z + ab in the requested direction.
The accumulator may alias either source and both sources may alias each other, including all three arguments sharing one object. The expression shall use entry values for every occurrence. Distinct source objects shall remain unchanged. No configured coefficient range or rational irrational-precision setting shall restrict the calculation. Object, resource, synchronization and initialization conditions shall follow 🔗 3. Configured native accumulation precision and truthful result relations.
RATIONALE: Product accumulation needs entry-accumulator semantics and a bound on the complete real expression even when an available native implementation uses more than one rounding.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for admitted same-format To, Left and Right types:
Result add_mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use exact dyadic rational expression oracles across source signs, cancellation, signed zeros, precision limits and subnormals. Cross all raw/checked forms and every accumulator/source alias whose entry values coincide. Check conservative directions, configured precision, statuses, source preservation and hardware state.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingaccumulationspec1.cc.
-
Incoming link from: 4. Checked named product accumulation1
2. Finite native floating subtraction of an accumulated product UID: PPL-SPEC-000522 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For finite accumulator and source entry values z, a and b and the types/preconditions in 🔗 1. Finite native floating addition of an accumulated product, sub_mul_assign_r shall accumulate z − ab using the configured native multiply/add precision and rounding protocol in 🔗 3. Configured native accumulation precision and truthful result relations. A directed result shall bound that exact real expression in the requested direction. Operand and accumulator aliases shall use their entry values, including all-three aliasing. Distinct sources shall remain unchanged; other prerequisites and preservation conditions shall follow 🔗 1. Finite native floating addition of an accumulated product.
RATIONALE: Subtracting a product must reverse the product sign before applying the directed bound to the full accumulated expression.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for admitted same-format To, Left and Right types:
Result sub_mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check independent exact expressions with both product signs, cancellation, zeros, subnormal and precision-boundary inputs. Include downward cases that distinguish negation after rounding from changing the fused operation, all admitted aliases, raw/checked forms and hardware preservation.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingaccumulationspec1.cc.
-
Incoming links from: 5. Extended accumulated products and enabled fault diagnosis 4. Checked named product accumulation 1. Finite native floating addition of an accumulated product 1. Finite native floating addition of an accumulated product 1. Finite native floating addition of an accumulated product 2. Finite native floating subtraction of an accumulated product6
3. Configured native accumulation precision and truthful result relations UID: PPL-SPEC-000523 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For each supported native format, when the matching fast-FMA path is enabled by the configured PPL_HAVE_DECL_FMA* capability, native FP_FAST_FMA* macro and platform support, a product accumulation shall use one final rounding of the exact complete expression. Otherwise, evaluation may use either a single contracted operation rounded in the destination format F, or separate product and addition operations in the configured native evaluation format E. E shall contain the values of F and shall be established from the supported compiler/backend settings and floating-point control state. It may equal F. For an x87 evaluation path with a 64-bit significand precision control, E is the binary extended format with 64 significand bits and the x87 exponent range. An intermediate product may be narrowed to F for storage and then reloaded exactly into E. The final result shall be narrowed to F.
Let rdT denote rounding to format T in direction d. For exact finite entry values z, a and b, a separate addition-of-product path shall therefore produce one of
rdF(rdE(z + rdE(ab))) or rdF(rdE(z + rdF(rdE(ab)))).
Only paths enabled by the configured compiler/backend and control state shall be admitted. Subtraction shall replace ab by − ab before any product rounding. For directed requests, every arithmetic step and narrowing store shall preserve the requested bound: downward for ROUND_DOWN and upward for ROUND_UP. An implementation may equivalently negate an upward bound to obtain a downward bound, provided that rounding occurs before the final negation. Consequently, separate evaluation need not produce the closest F bound on the complete expression. No other conservative value shall be admitted solely because it bounds that expression.
ROUND_IGNORE shall use the caller's hardware direction at each step. ROUND_NOT_NEEDED shall require every rounded step of the selected precision path to be exact and finite, and shall preserve the exact complete expression. ROUND_STRICT_RELATION shall not change value selection. Directed, strict or exactness requests shall require an upward native hardware direction; unflagged ROUND_IGNORE shall admit every supported hardware direction. Backend setup, floating-point exception and resource conditions, hardware preservation, live-object/synchronization requirements and initialization independence shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic.
For a finite result, unflagged downward/upward/delegated requests may return V_GE/V_LE/V_LGE respectively. With strict relation requested and sufficient inexact information, a directed request shall distinguish equality from the corresponding strict inequality. A strict delegated result shall contain the actual comparison between the exact complete expression and the stored value; intermediate rounding flags shall not by themselves justify excluding equality. When the available information cannot establish a strict comparison, the returned weak relation shall retain every possible actual comparison. Exactness requests shall use the exactness result rules in 🔗 4. Rounding, result classes and state for finite native binary arithmetic. Computed infinities shall carry their actual result class and relation, including an infinite directed bound caused by an intermediate overflow in a nonfused evaluation.
Signed zeros shall follow the selected precision path. A zero product shall use the exclusive-or of the factor signs, inverted for subtraction. At a final addition, two zero summands of the same sign shall retain that sign; opposite signs or exact cancellation of nonzero summands shall produce negative zero only for downward evaluation. A nonzero exact value of a rounded step that underflows to zero shall retain its sign. In a separate evaluation, these addition rules shall use the evaluated and, if stored, narrowed product, including its zero sign, rather than the exact complete-expression sign.
RATIONALE: Native multiply/add fusion, intermediate evaluation width and product storage are configuration dependent. Specifying their exact rounding paths preserves the permitted native implementation while excluding arbitrary conservative answers. Monotonicity of addition and directed rounding preserves the requested bound through each arithmetic and storage step; intermediate inexactness alone does not establish a strict comparison in every delegated mode.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for admitted same-format To, Left and Right types:
Result add_mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir); Result sub_mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check exact dyadic complete-expression and format-rounding oracles under fused and supported nonfused paths. Establish evaluation format and control precision independently of the observed result. Cover both retained and storage-narrowed products, directed bounds, caller-mode delegation, nearest-even double-rounding separators, signed zero at every step, subnormal/overflow boundaries, exactness preconditions and truth of every returned relation. Include cancellation separating the extended, fused-F and staged-F results, and reject conservative values outside the specified paths. Capture native oracle inputs and outputs at their storage width. Assess all raw/checked instantiations, aliases and hardware preservation.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingaccumulationspec1.cc.
-
1. Finite native floating-point addition and subtraction UID: PPL-SPEC-000481 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For admitted source/destination types and rounding requests in 🔗 4. Rounding, result classes and state for finite native binary arithmetic, add_assign_r(to, x, y, dir) shall compute the exact-real expression a + b and sub_assign_r the expression a − b, where a and b are the finite represented entry values of the two sources. The destination shall hold the rounded value and the returned Result shall describe it as specified there. Overflow into an infinite bound shall not introduce a bounded coefficient intermediate.
For an exact zero sum, equal-sign zero operands shall retain their common sign. All other exact-zero sums, including cancellation of nonzero values, shall produce negative zero under downward evaluation and positive zero under upward, toward-zero or nearest-even evaluation. For subtraction this rule shall apply to the signs of x and the negation of y. A nonzero exact result rounded to zero shall retain that real result's sign.
Source aliases, object validity, preservation, synchronization, backend setup, initialization independence and floating-point state prerequisites shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic.
RATIONALE: Addition and subtraction supply native directed bounds while preserving cancellation and IEEE signed-zero distinctions needed by subsequent numerical operations.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for the admitted same-format To, Left and Right types:
Result add_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir); Result sub_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Compare exact dyadic sums and differences with independent rational oracles for all admitted raw/checked operand forms. Include cancellation, signed zeros, adjacent values, precision loss, subnormal boundaries and range-limit results. Check tight bounds, statuses, zero signs, aliases, distinct-source preservation and hardware direction.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingarithmeticspec1.cc; tests/numericpublic1.cc.
-
2. Finite native floating-point multiplication UID: PPL-SPEC-000482 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For admitted source/destination types and rounding requests in 🔗 4. Rounding, result classes and state for finite native binary arithmetic, mul_assign_r(to, x, y, dir) shall compute the exact-real product ab of the finite represented source entry values. It shall assign the rounded product and return the Result specified there. A zero product, including one produced by underflow, shall have the exclusive-or of the source sign bits. This shall include both signs of zero, ordinary values, finite extrema and subnormals.
No bounded coefficient intermediate shall limit the native format's range. Source aliases, object validity, preservation, synchronization, backend setup, initialization independence and floating-point state prerequisites shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic.
RATIONALE: A native product must bound its exact represented operands through both precision loss and underflow. Its zero sign remains defined even when the exact nonzero product is too small for finite nonzero storage.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for the admitted same-format To, Left and Right types:
Result mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use independent exact rational products across signs, signed zeros, significand boundaries, powers of two, subnormal/half-subnormal cases and finite range limits. Cross all admitted operand forms, check tight directed/delegated values, statuses, zero signs, aliases and state preservation.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingarithmeticspec1.cc; tests/numericpublic1.cc.
-
3. Finite native floating-point division by a nonzero value UID: PPL-SPEC-000483 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For admitted source/destination types and rounding requests in 🔗 4. Rounding, result classes and state for finite native binary arithmetic, div_assign_r(to, x, y, dir) shall require a nonzero finite divisor and a finite numerator. It shall compute the exact-real quotient a ⁄ b from their represented entry values, assign its rounded value and return the Result specified there. A zero quotient, including one produced by underflow, shall have the exclusive-or of the source sign bits.
The quotient may be nondyadic and shall not be described as exact merely because the division completed. No bounded coefficient intermediate shall limit the native format's range. Source aliases, object validity, preservation, synchronization, backend setup, initialization independence and floating-point state prerequisites shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic.
RATIONALE: Finite division needs a nonzero-divisor precondition and a distinction between exact dyadic quotients and conservative bounds on nondyadic real quotients.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for the admitted same-format To, Left and Right types:
Result div_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Compare quotients with exact rational oracles for signed ratios such as one- third, exact powers of two, signed-zero numerators, precision boundaries, subnormals, tiny nonzero divisors and finite range limits. Cross all admitted raw/checked forms and aliases, checking tight bounds, precision statuses, zero signs, source preservation and hardware direction.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingarithmeticspec1.cc; tests/numericpublic1.cc.
-
Incoming links from: 1. Same-storage checked compound arithmetic 1. Finite native floating addition of an accumulated product 3. Configured native accumulation precision and truthful result relations 3. Configured native accumulation precision and truthful result relations 1. Finite native floating-point addition and subtraction 1. Finite native floating-point addition and subtraction 2. Finite native floating-point multiplication 2. Finite native floating-point multiplication 3. Finite native floating-point division by a nonzero value 3. Finite native floating-point division by a nonzero value 1. Finite native addition and subtraction of a power of two 1. Finite native addition and subtraction of a power of two 1. Finite native addition and subtraction of a power of two 2. Finite native multiplication and division by a power of two 2. Finite native multiplication and division by a power of two 1. Truncated native floating quotient before storage rounding 1. Truncated native floating quotient before storage rounding 3. Exact centered native residue modulo a power of two 4. Rounded nonnegative native residue modulo a power of two 4. Rounded nonnegative native residue modulo a power of two 1. Directed and delegated square root of a finite native value 1. Directed and delegated square root of a finite native value 1. Directed and delegated square root of a finite native value23
4. Rounding, result classes and state for finite native binary arithmetic UID: PPL-SPEC-000484 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The native storage format F shall be configured and supported as in 🔗 1. Supported exact integer and rational conversion to native floating storage. Each destination and source shall be F or Checked_Number<F, Check_Overflow_Policy<F>>, with the same format for all operands. Sources shall be finite and shall meet the particular operation's mathematical preconditions in 🔗 1. Finite native floating-point addition and subtraction, 🔗 2. Finite native floating-point multiplication or 🔗 3. Finite native floating-point division by a nonzero value. Let q be that operation's exact-real result.
ROUND_DOWN shall assign the greatest native representable bound no greater than q, and ROUND_UP the least bound no less than it, including subnormal and infinite bounds. Without a strict flag it shall return the downward weak relation V_GE or upward V_LE. With ROUND_STRICT_RELATION and definite native inexact information, an exact result shall have relation VR_EQ, an inexact downward result VR_GT and an inexact upward result VR_LT. If native inexact information is unavailable, the corresponding weak relation shall be returned.
ROUND_IGNORE shall evaluate using the current hardware direction, including nearest-even midpoint selection. An unflagged request shall have lazy relation VR_LGE. A strict delegated request with definite inexact information shall have VR_EQ for exactness and VR_NE for inexactness; unavailable information shall give VR_LGE. ROUND_NOT_NEEDED shall require q to be exactly representable as a finite value. It shall assign that exact value, return V_EQ in an assertion-enabled build and may return lazy V_LGE in a build defining NDEBUG. A strict no-rounding-needed request shall retain that precondition and return V_EQ.
The returned class shall be VC_NORMAL for a finite computed value, VC_PLUS_INFINITY for positive infinity and VC_MINUS_INFINITY for negative infinity, combined with the corresponding relation. These native values shall be representable without V_UNREPRESENTABLE. For an exact real magnitude exceeding the finite maximum, inward directed evaluation shall return the signed finite endpoint and outward evaluation the corresponding infinity. Delegated range behavior shall follow the native hardware mode and nearest-overflow threshold in 🔗 6. Range limits in conversion of finite native scalars to floating point. A finite inward endpoint shall not promise an integer-overflow annotation.
Directed, strict and no-rounding-needed requests shall require upward hardware rounding. An unflagged delegated request shall require no particular current direction. Calls shall preserve that direction; accrued exception flags shall be unspecified and floating-point exceptions shall be nontrapping. Native FPU backend setup shall follow 🔗 1. Directed native integral conversion to native floating-point storage. No library/thread initialization object shall be required on backends requiring no setup, and no coefficient-constant stage or shared numerical temporary pool shall be required.
The destination shall be live and assignable. It may be either source; the sources may designate the same object; and storage may be shared through a checked object's raw-value reference. Results shall use both source entry values. Sources with storage distinct from the destination shall remain unchanged. Callers shall synchronize access against concurrent mutation. The _r interfaces shall return their results without policy-handler dispatch.
RATIONALE: Native binary arithmetic needs one consistent meaning for rounded payloads, relation precision, result classes and the FPU environment. A correct mathematical bound does not excuse an incorrect annotation of an infinite computed value.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for the admitted same-format To, Left and Right types:
Result add_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir); Result sub_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir); Result mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir); Result div_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Cross the binary operations and admitted raw/checked source/destination forms with exact rational value oracles. Check adjacent directed bounds, all hardware modes for unflagged delegation, nearest-even ties, weak/strict/unknown classifications, valid exactness requests, finite and infinite range results, signed zeros and source/destination aliases. Verify unchanged direction, no initialization-stage dependence on setup-free backends and compilation without unavailable native formats.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingarithmeticspec1.cc; tests/numericpublic1.cc.
-
2. Directed conversion to adjacent finite normal floating-point bounds UID: PPL-SPEC-000202 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For source value a within the destination finite range, with |a| at least the smallest positive normal value and not exactly representable, base direction ROUND_DOWN shall assign the greatest representable destination value less than a; base direction ROUND_UP shall assign the least representable value greater than a. The destination types, sources and object prerequisites shall follow 🔗 1. Supported exact integer and rational conversion to native floating storage.
The downward call shall return V_GT and the upward call shall return V_LT. These shall be definite exact-to-computed relations as defined by 🔗 1. Numerical result classes and relation meanings, whether or not the request carries ROUND_STRICT_RELATION. Both bounds shall be finite and adjacent in the native value set. A source halfway between adjacent values shall follow the specified bound direction; no nearest-even tie rule shall replace it. Exact representable values shall instead follow 🔗 1. Supported exact integer and rational conversion to native floating storage.
RATIONALE: A directed conversion selects an adjacent representable bound. Halfway inputs distinguish that obligation from nearest rounding, and an unbounded source can expose lost low significand bits precisely.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for a configured supported native floating-point type T:
Result assign_r(T& to, const mpz_class& from, Rounding_Dir dir); Result assign_r(T& to, const mpq_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Construct exact rational quarter, half and three-quarter points between independently established adjacent native values, including either sign, binade boundaries and the largest finite pair. Check the two exact endpoint values and strict Result codes. Include integer halfway values just beyond the exact-integer precision threshold through both mpz and mpq source paths, without overflowing native oracle arithmetic.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingconversionspec1.cc; tests/numericpublic1.cc.
-
3. Directed conversion in the subnormal and underflow range UID: PPL-SPEC-000203 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: Let δ be the smallest positive representable native subnormal value and let N be the smallest positive normal value. For a finite rational source with 0 < |a| < N, ROUND_DOWN shall assign the greatest native value not exceeding a, and ROUND_UP the least native value not less than a. Zero and every supported subnormal value shall be included when selecting these bounds. Source, destination and lifetime prerequisites shall follow 🔗 1. Supported exact integer and rational conversion to native floating storage.
An exactly representable subnormal shall return V_EQ. Otherwise the downward result shall return V_GT and the upward result V_LT, with or without a strict-relation flag. In particular, 0 < a < δ shall yield zero downward and δ upward; − δ < a < 0 shall yield − δ downward and zero upward. No sign-bit value shall be prescribed for a computed zero. The results shall be normal-class numerical bounds with no unrepresentable-storage flag.
RATIONALE: Underflow must retain an outward bound even when a nonzero rational is smaller than every native nonzero value. Treating these cases as unconditional zero would lose the requested direction.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for a configured supported native floating-point type T:
Result assign_r(T& to, const mpz_class& from, Rounding_Dir dir); Result assign_r(T& to, const mpq_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check exact minimum and larger subnormals, fractions below the minimum, their signs, subnormal halfway points, and the pair straddling the largest subnormal and smallest normal value. Establish rational values with integer powers of two and independently compare the returned zero/subnormal endpoints, exact or strict relations and storage flags under all hardware rounding states.
SOURCE: tests/floatrepresentationsspec1.cc; src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingconversionspec1.cc.
-
Incoming links from: 1. Exact coefficient ratio followed by upward scalar conversion 1. Supported exact integer and rational conversion to native floating storage 4. Delegated and exactness requests for floating-point conversion 1. Truncated native floating quotient before storage rounding 1. Truncated native floating quotient before storage rounding 4. Numeric text input into supported native floating destinations6
5. Floating conversion overflow thresholds and computed-value classes UID: PPL-SPEC-000205 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a supported destination type in 🔗 1. Supported exact integer and rational conversion to native floating storage, let p be its binary precision, emax its max_exponent, H = 2emax and M = (2p − 1)2emax − p, its largest finite value. Each source shall be a finite integer or canonical rational and satisfy the object prerequisites of 🔗 1. Supported exact integer and rational conversion to native floating storage. An optional strict-relation flag shall not change the following outcomes.
For M < a < H, ROUND_DOWN and ROUND_IGNORE shall assign M and return V_GT. ROUND_UP shall assign positive infinity and return V_LT_PLUS_INFINITY. For − H < a < − M, ROUND_UP and ROUND_IGNORE shall assign − M and return V_LT; ROUND_DOWN shall assign negative infinity and return V_GT_MINUS_INFINITY. Computed infinity shall carry its corresponding infinity class, including when obtained by stepping past a finite endpoint.
For a ≥ H, ROUND_DOWN shall assign M and return V_GT_SUP; ROUND_UP and ROUND_IGNORE shall assign positive infinity and return V_LT_PLUS_INFINITY. For a ≤ − H, ROUND_UP shall assign − M and return V_LT_INF; ROUND_DOWN and ROUND_IGNORE shall assign negative infinity and return V_GT_MINUS_INFINITY.
These numeric range outcomes shall be returned directly, without policy exception dispatch, and shall leave the destination usable. The native infinities shall be representable, so V_UNREPRESENTABLE shall be absent. ROUND_NOT_NEEDED shall exclude these out-of-range sources.
RATIONALE: A finite inward rounding immediately beyond the endpoint differs from clamping a value whose unrestricted-exponent rounded result is itself outside the finite format. In every case the reported class must agree with a computed infinite bound.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for a configured supported native floating-point type T:
Result assign_r(T& to, const mpz_class& from, Rounding_Dir dir); Result assign_r(T& to, const mpq_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check integer and rational sources just beyond both finite endpoints, H and its negative, and larger magnitude values. Require inward endpoint values, outward infinity signs and exact Result classes/flags for every admitted direction. Check both signs and source paths around the finite-to-infinity successor/predecessor transition, then reassign destinations and preserve sources.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingconversionspec1.cc.
-
1. Finite native addition and subtraction of a power of two UID: PPL-SPEC-000504 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The source and destination shall have the admitted same-format native or Checked_Number<F, Check_Overflow_Policy<F>> types in 🔗 4. Rounding, result classes and state for finite native binary arithmetic. The source shall be finite with represented value a. The exponent e shall be less than CHAR_BIT * sizeof(unsigned long long), and 2e shall be exactly representable and finite in F.
add_2exp_assign_r shall compute a + 2e and sub_2exp_assign_r shall compute a − 2e. They shall assign the corresponding rounded value and return the result class/relation in 🔗 4. Rounding, result classes and state for finite native binary arithmetic. The power-of-two operand shall introduce no intermediate conversion error. Zero-result signs shall follow the addition/subtraction rules in 🔗 1. Finite native floating-point addition and subtraction with a positive second operand 2e.
Source/destination aliases, source preservation, object validity, synchronization, direction and exactness prerequisites, native backend setup, initialization independence and floating-point exception conditions shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic. Neither the source value nor the exponent shall be converted through the configured coefficient type.
RATIONALE: Adding an exactly represented power of two avoids an unintended source-constant approximation while retaining the ordinary native rounding and range rules.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for admitted same-format To and From types:
Result add_2exp_assign_r(To& to, const From& from, unsigned exp, Rounding_Dir dir); Result sub_2exp_assign_r(To& to, const From& from, unsigned exp, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check exponent zero, significand-neighbor exponents and the largest admitted exponent with exact integer/dyadic rational oracles. Include cancellation to signed zero, subnormals, precision-loss cases and finite range endpoints. Cross raw/checked forms, directed/delegated/strict statuses, nearest-even selection, aliases and hardware-state preservation.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingdyadicspec1.cc.
-
Incoming link from: 5. Checked named scaling by powers of two1
2. Finite native multiplication and division by a power of two UID: PPL-SPEC-000505 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the source/destination types, finite source value a and exponent preconditions in 🔗 1. Finite native addition and subtraction of a power of two, mul_2exp_assign_r shall compute a2e and div_2exp_assign_r shall compute a ⁄ 2e. They shall assign the rounded value and return the result class/relation in 🔗 4. Rounding, result classes and state for finite native binary arithmetic. The positive power-of-two operand shall be exact and nonzero. A zero result, including one caused by underflow, shall retain the source sign.
A power-of-two scale shall not promise exactness when exponent-range or subnormal precision limits require approximation. Exponent zero shall preserve the represented source value; its status precision shall still follow the native binary arithmetic protocol. Source aliases, source preservation, object validity, synchronization, direction and exactness prerequisites, native backend setup, initialization independence and floating-point exception conditions shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic. No bounded coefficient intermediate shall limit the native format's value range.
RATIONALE: Binary scaling is exact while the shifted significand fits the destination format, but underflow and range crossings still require explicit conservative outcomes.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for admitted same-format To and From types:
Result mul_2exp_assign_r(To& to, const From& from, unsigned exp, Rounding_Dir dir); Result div_2exp_assign_r(To& to, const From& from, unsigned exp, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use exact dyadic scaling oracles at exponent zero, precision boundaries and the largest admitted exponent. Exercise exact powers, signed zeros, normal/subnormal transitions, half-subnormal underflow, large finite magnitudes and inward range endpoints for raw/checked forms. Check tight rounded values, weak/strict/delegated statuses, aliases, source preservation and hardware direction.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingdyadicspec1.cc.
-
1. Truncated native floating quotient before storage rounding UID: PPL-SPEC-000506 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The source and destination types shall be the admitted same-format native or Checked_Number<F, Check_Overflow_Policy<F>> types in 🔗 4. Rounding, result classes and state for finite native binary arithmetic. Both sources shall be finite, with represented values a and b, and b ≠ 0. Let n = trunc(a ⁄ b), where truncation is toward zero in exact real arithmetic. idiv_assign_r shall round and store n in F; it shall not substitute truncation of an already rounded real quotient.
ROUND_DOWN shall select the greatest representable value not exceeding n; ROUND_UP shall select the least representable value not less than n, with admitted infinite endpoints as in 🔗 5. Floating conversion overflow thresholds and computed-value classes. For n in the finite native range, ROUND_IGNORE shall round n toward zero, independently of the caller's hardware direction. Outside that range, it shall follow the explicit delegated overflow value-selection rules in 🔗 5. Floating conversion overflow thresholds and computed-value classes, including their signed infinite endpoints. ROUND_NOT_NEEDED shall require n to be finite and exactly representable in F. Adding ROUND_STRICT_RELATION shall retain the same value-selection rules. For a finite result, the returned relation shall be V_EQ, V_GT or V_LT according as n is equal to, greater than or less than the stored value. Infinite endpoints shall carry their actual result class and relation: positive infinity shall return V_LT_PLUS_INFINITY and negative infinity shall return V_GT_MINUS_INFINITY, also for nonstrict requests. A zero result shall have the exclusive-or of the source signs.
The native hardware direction shall be upward, except that an exactly representable integral real quotient a ⁄ b shall require no particular hardware direction. The operation shall preserve the hardware direction. Native backend setup, live-object and source/destination alias rules, exception conditions and initialization independence shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic. The operands may alias each other. Distinct source objects shall remain unchanged. Resources for exact integer/rational temporaries shall be available, and their temporary pools shall be serialized in a build without thread-safe support. Neither the configured coefficient range nor irrational-precision settings shall restrict the quotient.
RATIONALE: Truncating an approximate real quotient can cross an integer boundary. The integer quotient must be established before any unavoidable destination precision loss, including when the mathematical quotient exceeds the native format's consecutive-integer range.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for admitted same-format To, Left and Right types:
Result idiv_assign_r(To& to, const Left& left, const Right& right, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use exact dyadic source extraction and an independent integer quotient oracle. Check all source signs, signed zero, rounded quotients adjacent to integer boundaries, consecutive-integer precision limits, exact large quotients and inexact large integer storage. Exercise direct, strict, delegated and admitted exactness requests, finite/infinite range endpoints, raw/checked combinations, operand and destination aliases, source preservation and hardware direction.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingresiduesspec1.cc.
-
4. Rounded nonnegative native residue modulo a power of two UID: PPL-SPEC-000509 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the source/destination types, finite source value a and admitted power-of-two modulus m in 🔗 3. Exact centered native residue modulo a power of two, umod_2exp_assign_r shall compute the unique mathematical residue u ∈ [0, m) congruent to a modulo an integer multiple of m. Let r = a − trunc(a ⁄ m)m.
When r ≥ 0, the operation shall store r exactly and return V_EQ for every valid request, without a hardware-direction prerequisite. When r < 0, it shall round and store r + m using the value, relation-precision, hardware-direction and exactness rules for native addition in 🔗 4. Rounding, result classes and state for finite native binary arithmetic. The returned relation shall compare the exact mathematical u with the stored value. A directed upward or delegated bound may equal m when u is not representable; the rounded value shall not be reduced again. ROUND_NOT_NEEDED shall require u to be exactly representable. If the mathematical residue is zero, the stored zero shall retain the source sign.
The operation shall preserve the hardware direction. Backend setup, live objects, synchronization, aliases, source preservation, initialization independence and floating-point exception conditions shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic. No coefficient-range limit or irrational-precision setting shall restrict the calculation.
RATIONALE: For a negative tiny source, the nonnegative residue can lie immediately below the modulus without being representable. Directed rounding must bound that mathematical residue and may therefore reach the modulus itself.
INTERFACE: Public header: <ppl.hh>; effective template instantiations for admitted same-format To and From types:
Result umod_2exp_assign_r(To& to, const From& from, unsigned exp, Rounding_Dir dir);
VERIFICATION_CRITERIA: Compare with independent exact rational residues for both source signs, modulus multiples, half-modulus neighbors, negative subnormals and very large inputs. Check directed and delegated endpoint selection, strict and weak relations, admitted exactness requests, exponent limits, signed zeros, source/destination aliases, raw/checked forms and hardware preservation.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingresiduesspec1.cc.
-
2. Directed finite floating-to-integral rounding within range UID: PPL-SPEC-000242 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a finite source value a and admitted source/destination types from 🔗 1. Supported finite native floating-to-integral scalar conversion, ROUND_DOWN shall assign ⌊a⌋ and ROUND_UP shall assign ⌈a⌉ whenever that requested integer is representable. A nonintegral source shall require the upward hardware rounding mode in 🔗 1. Supported finite native floating-to-integral scalar conversion. An optional ROUND_STRICT_RELATION flag shall not change the mathematical result.
A nonintegral downward result shall return V_GT and a nonintegral upward result shall return V_LT, with exact-to-computed orientation from 🔗 1. Numerical result classes and relation meanings. An integral source shall return V_EQ. A source just outside the destination's integer endpoints whose requested rounded integer is an endpoint shall produce that ordinary definite relation, without an integer-range-overflow annotation. This shall include upward rounding of a negative proper fraction to unsigned zero.
Out-of-range rounded integers shall follow 🔗 4. Floating-to-integral range detection and reusable destinations. Source, object-synchronization, lifetime and hardware-mode preservation shall follow 🔗 1. Supported finite native floating-to-integral scalar conversion.
RATIONALE: A conversion selects the requested integer bound. The original floating value may lie beyond an integer endpoint even though the requested bound is a valid endpoint, so source range and rounded-result range must be distinguished.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source and destination types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use exact dyadic proper and improper fractions of both signs and verify floor/ceiling with an independent integer quotient/remainder oracle. Cover strict and nonstrict requests, interior integers and adjacent fractions at every destination endpoint, including inward rounding from outside and unsigned zero. Preserve upward hardware mode and distinct sources.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingtointegerspec1.cc.
-
4. Floating-to-integral range detection and reusable destinations UID: PPL-SPEC-000244 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For the admitted types and valid hardware prerequisites in 🔗 1. Supported finite native floating-to-integral scalar conversion, let q be the requested floor, ceiling or truncated integer defined by 🔗 2. Directed finite floating-to-integral rounding within range and 🔗 3. Delegated floating-to-integral truncation and exactness requests. If q lies below the destination minimum, ROUND_UP shall store that minimum and return V_LT_INF; ROUND_DOWN or ROUND_IGNORE shall return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE. If q lies above the maximum, ROUND_DOWN shall store that maximum and return V_GT_SUP; ROUND_UP or ROUND_IGNORE shall return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE. An optional strict flag shall not change these range outcomes.
A requested integer within range shall follow the ordinary classifications of 🔗 2. Directed finite floating-to-integral rounding within range and 🔗 3. Delegated floating-to-integral truncation and exactness requests. Checking range shall not itself require an undefined native floating-to-integer cast, including when a floating source format cannot represent the destination's maximum integer exactly. A failed range request shall not report a wrapped integer as successful. An unrepresentable result shall leave the destination assignable and destructible without a payload-value guarantee. ROUND_NOT_NEEDED shall exclude out-of-range inputs. These result codes shall be returned directly without automatic policy exception dispatch.
RATIONALE: Safe conversion must guard the actual requested integer range before any narrowing native cast. A finite source can exceed a destination bound even when the source format rounds that bound to a different floating value.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source and destination types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use unbounded dyadic oracles for every signed/unsigned endpoint and neighboring representable floating values. Include the largest source-representable integer inside each destination, the first outside it, large finite source maxima and negative values targeting unsigned storage. Require exact range codes, inward endpoints, outward flags, reusable outputs and no undefined-behavior sanitizer findings under valid hardware modes.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingtointegerspec1.cc.
-
3. Directed rational-to-integral conversion within range UID: PPL-SPEC-000163 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a finite canonical rational source with value a , assign_r with base direction ROUND_DOWN shall assign ⌊a⌋ ; with base direction ROUND_UP it shall assign ⌈a⌉ . The destination shall be one of the native or checked integral types in 🔗 1. Exact conversion between native and checked integral scalars . Canonical rational representation shall follow 🔗 1. Exact rational assignment from rational and integral sources .
For a directed integer result representable in the destination, an integral source value shall produce V_EQ . A nonintegral value rounded downward shall produce V_GT and a nonintegral value rounded upward shall produce V_LT , with exact-to-computed relation orientation as in 🔗 1. Numerical result classes and relation meanings . Adding ROUND_STRICT_RELATION shall preserve these values and definite classifications.
Out-of-range outcomes for either destination form shall follow 🔗 6. Rational conversion at and beyond integral endpoints . This conversion shall return Result without policy-handler dispatch. The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage. Rational-source conversions shall use thread-local temporary storage in a thread-safe build; callers shall serialize those conversions across threads in a non-thread-safe build.
RATIONALE: Rational conversion selects a neighboring integer according to the requested direction. Its exact relation can be established from integer quotient and remainder without floating-point approximation.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above; From shall be mpq_class.
VERIFICATION_CRITERIA: Use literal fractions and an independent integer quotient/remainder oracle for both signs, exact integers, halves and proper fractions. Check floor/ceiling values and definite result relations in every native and checked destination, including rounded values equal to either endpoint and source values just outside an endpoint that round inward.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc .
-
6. Rational conversion at and beyond integral endpoints UID: PPL-SPEC-000166 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a finite canonical rational source and a native or checked integral destination from 🔗 1. Exact conversion between native and checked integral scalars , assign_r shall distinguish a representable directed or truncated integer from range failure without policy-handler dispatch. Canonical representation shall follow 🔗 1. Exact rational assignment from rational and integral sources .
If truncating the rational toward zero already lies below or above the destination range, the conversion shall return the corresponding range outcome specified in 🔗 5. Integral scalar conversion range outcomes for the requested base direction. If that truncation lies within range but subsequent upward rounding would increase the maximum, it shall return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE . If subsequent downward rounding would decrease the minimum, it shall return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE . These shall not be reported as successful wrapped integers.
Representable rounded values shall follow 🔗 3. Directed rational-to-integral conversion within range or 🔗 4. Truncated rational-to-integral conversion and lazy relation requests , including a rational just beyond an endpoint whose requested integer rounds inward to that endpoint. An unrepresentable outcome shall preserve destination assignability and destructibility without a payload value promise. ROUND_NOT_NEEDED shall admit only exact representable integer results. A Checked_Number destination whose policy disables overflow checking shall remain outside this range-detection guarantee. The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage. Rational-source conversions shall use thread-local temporary storage in a thread-safe build; callers shall serialize those conversions across threads in a non-thread-safe build.
RATIONALE: Fractional endpoint crossings can fail during the directed increment or decrement even when the truncated quotient fits. They differ from a quotient already outside the destination range.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above; From shall be mpq_class and To an admitted native or checked destination type.
VERIFICATION_CRITERIA: Use exact thirds and halves immediately inside and outside every signed and unsigned endpoint, plus integral and fractional values more than one unit beyond it. Compare quotient/remainder-derived range cases and exact returned flags, both directed signs and strict requests; check valid unflagged lazy truncation separately. Require inward endpoint values and reusable outputs while preserving source components.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc .
-
Incoming links from: 4. Rounding, result classes and state for finite native binary arithmetic 2. Delegated and exactness native integral conversion to native floating point 2. Delegated and exactness native integral conversion to native floating point 2. Delegated and exactness native integral conversion to native floating point 2. Delegated and exactness native integral conversion to native floating point 3. Exact native floating-point assignment to the same or a wider native format 4. Directed narrowing between finite native floating-point formats 6. Range limits in conversion of finite native scalars to floating point 2. Mixed finite floating and exact scalar ordering9
1. Directed native integral conversion to native floating-point storage UID: PPL-SPEC-000341 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: The destination shall be a configured supported native floating-point type F in 🔗 1. Supported exact integer and rational conversion to native floating storage, or Checked_Number<F, Check_Overflow_Policy<F>>. The source shall be one of the eleven native integral types in 🔗 1. Exact conversion between native and checked integral scalars, or its Checked_Number<I, Check_Overflow_Policy<I>> wrapper, with integer value a. It shall be independent of the configured Coefficient alias.
Within the destination finite range, ROUND_DOWN shall assign the greatest representable value no greater than a; ROUND_UP shall assign the least representable value no less than a. Exactly representable integers shall preserve their values. Source-range crossings shall follow 🔗 6. Range limits in conversion of finite native scalars to floating point. Zero shall produce positive zero.
Let p be std::numeric_limits<F>::digits and w the native source type's object width CHAR_BIT * sizeof(I). When p > w, conversion shall return V_EQ under every directed/strict request and shall require no particular hardware rounding direction. Otherwise, downward conversion shall return V_GE and upward conversion V_LE without the strict flag. With that flag and available definite native inexact information, an exact result shall return V_EQ and an inexact result V_GT downward or V_LT upward. If definite inexact information is unavailable, the corresponding weak relation shall be returned. These potentially inexact directed conversions shall require upward hardware rounding and shall preserve that direction.
The destination shall be live and assignable, and a distinct source shall remain unchanged. Callers shall synchronize access against concurrent object mutation. Floating-point exceptions shall be nontrapping; accrued flags shall be unspecified. Native conversions using FPU control or inexact queries shall require an available backend. On IA-32 backends using SSE, runtime SSE detection shall have completed before those facilities are used, through 🔗 1. Initialization owners and automatic C++ initialization and 🔗 3. Thread initialization, default state and finalization or fpu_initialize_control_functions(). C99-fenv and SPARC backends shall require no library or thread initialization object. No coefficient-constant stage or shared numerical temporary pool shall be required. The _r interface shall return the conversion result without policy-handler dispatch.
RATIONALE: Native integer embedding can remain exact or provide adjacent directed bounds without introducing an intermediate bounded coefficient. Result precision and native floating-point state prerequisites are part of that conversion interface.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted integral From and floating To types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Cross every configured destination format with all eleven native integral types and their checked wrappers. Check full endpoints, zero, signed values and precision-boundary integers against independent unbounded-integer/dyadic oracles. Require adjacent directed bounds, exact or weak/strict classifications as specified, positive zero, preserved sources and hardware direction; use every hardware mode for uniform exact embeddings.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/nativefloatingconversionspec1.cc. tests/smallconstantassign1.cc.
-
4. Directed narrowing between finite native floating-point formats UID: PPL-SPEC-000344 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For configured native source/destination formats and raw or checked types in 🔗 3. Exact native floating-point assignment to the same or a wider native format with sizeof(From_native) > sizeof(To_native), the source shall be finite with exact represented value a. When a lies within destination finite range, ROUND_DOWN shall assign the greatest representable value no greater than a; ROUND_UP shall assign the least representable value no less than a. This shall include transitions between normal, subnormal and signed-zero values. A zero result shall retain the source's sign. Source-range crossings shall follow 🔗 6. Range limits in conversion of finite native scalars to floating point.
Without ROUND_STRICT_RELATION, downward conversion shall return V_GE and upward conversion V_LE, even for an exactly representable source. With the flag and definite native inexact information, it shall return V_EQ for exactness, V_GT for an inexact downward result and V_LT for an inexact upward result. When definite inexact information is unavailable, it shall return the corresponding weak relation.
These directed conversions shall require upward hardware rounding and shall preserve that direction. The source shall remain unchanged and the destination shall be live and assignable. Object synchronization, backend setup, availability, initialization independence, exception conditions and result-returning behavior shall follow 🔗 1. Directed native integral conversion to native floating-point storage.
RATIONALE: Native narrowing must preserve the selected bound even across underflow into subnormal or zero values. A weak relation remains meaningful when a backend cannot resolve native inexactness.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted floating-point To and From types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: For every actual narrowing pair and raw/checked combination, use exact significand rational oracles at midpoint neighborhoods, precision limits, normal/subnormal transitions and tiny nonzero inputs. Check tight bounds, signed zeros, exact/weak/strict classifications, source preservation and unchanged upward hardware direction. Exercise definite and unavailable native inexact classifications.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/nativefloatingconversionspec1.cc.
-
Incoming links from: 4. Rounding, result classes and state for finite native binary arithmetic 1. Directed native integral conversion to native floating-point storage 2. Delegated and exactness native integral conversion to native floating point 4. Directed narrowing between finite native floating-point formats 5. Delegated and exactness native floating-point narrowing5
6. Range limits in conversion of finite native scalars to floating point UID: PPL-SPEC-000346 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For the native scalar conversions in 🔗 1. Directed native integral conversion to native floating-point storage and 🔗 4. Directed narrowing between finite native floating-point formats, let M be the destination's maximum finite value and let a be a finite source outside [ − M, M]. For a > M, downward conversion shall assign M and upward conversion positive infinity. For a < − M, upward conversion shall assign − M and downward conversion negative infinity.
Delegated conversion shall use the current hardware direction. Toward-zero mode shall choose the finite endpoint; directed modes shall choose the corresponding endpoint or infinity above. In nearest-even mode, let u = 2emax − p be the last finite binade's spacing, where std::numeric_limits<F>::max_exponent is emax and destination precision is p. A magnitude below M + u ⁄ 2 shall choose the finite endpoint; a magnitude at or above that threshold shall choose the corresponding infinity.
Every finite computed endpoint shall have class VC_NORMAL and shall use the weak/strict relation of its conversion request. Every computed positive infinity shall have class VC_PLUS_INFINITY and every computed negative infinity VC_MINUS_INFINITY, with the corresponding conversion relation. These native infinities shall be representable, without V_UNREPRESENTABLE. The conversion shall not promise an integer-overflow annotation for a finite directed endpoint. No-rounding-needed requests shall retain their finite exact-representability precondition and shall not admit these source values. Object, state, availability and backend prerequisites shall follow the applicable conversion above.
RATIONALE: A directed finite endpoint and an infinite bound can both be valid approximations. The result class must nevertheless describe the value actually stored, independently of how precisely its relation is reported.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted floating-point To and From types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use both signs of source values immediately beyond the destination maximum, the nearest-overflow midpoint and much larger finite values for every narrowing format pair. Check directed and delegated values, exact class fields, weak/strict relations and representability; repeat for native integral sources whenever their available width reaches this range. Preserve sources and hardware direction, with no invalid native casts or no-rounding-needed requests.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/nativefloatingconversionspec1.cc.
-
2. Directed native integer division and delegated truncation UID: PPL-SPEC-000832 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For argument types, entry-operand finite ranges and lifetime/alias prerequisites from 🔗 1. Exact same-storage native integer arithmetic, let the divisor b be nonzero and let q = a ⁄ b be the exact rational quotient. div_assign_r with ROUND_DOWN shall assign ⌊q⌋; with ROUND_UP it shall assign ⌈q⌉. A successful result shall give a relation containing the exact ordering of q relative to the stored integer. With ROUND_STRICT_RELATION, it shall identify precisely equality, strict greater-than or strict less-than through V_EQ, V_GT or V_LT.
ROUND_IGNORE shall store the quotient truncated toward zero and may return a relation containing equality and either strict order. A strict request shall identify the exact relation between q and that stored integer. ROUND_NOT_NEEDED shall require an exact representable quotient; it shall store that quotient and return a relation admitting equality. A strict exactness request shall return V_EQ. An out-of-range quotient shall follow 🔗 4. Checked native arithmetic range outcomes when checking is enabled, and shall be outside the unchecked successful-result precondition otherwise.
Quotient rounding and relation classification shall use entry operands even if the destination aliases the dividend or divisor. Sources not sharing the destination shall remain unchanged. Calls shall retain the handler, initialization, synchronization and hardware-direction conditions of 🔗 1. Exact same-storage native integer arithmetic.
RATIONALE: Bounded integer division needs a defined rounding convention and an honest relation to the exact rational quotient, including delegated truncation.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for the admitted argument types:
Result div_assign_r(To& to, const X& x, const Y& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Derive floor, ceiling and truncation from independent unbounded integer quotient/remainder calculations for every sign combination. Check exact and inexact quotients, zero dividends, full signed and unsigned endpoints, all admitted rounding and strictness requests, source aliases and preserved entry values. Assess checked range failure separately from successful representable division.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_ext_inlines.hh; tests/nativeintegerarithmeticspec1.cc.
-
Incoming link from: 5. Checked named scaling by powers of two1
2. Directed native integer division by powers of two UID: PPL-SPEC-000838 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For the same-storage finite entry values and prerequisites in 🔗 1. Exact same-storage native integer arithmetic, div_2exp_assign_r shall divide the exact integer source by 2e, for every unsigned int exponent e. ROUND_DOWN shall store its floor, ROUND_UP its ceiling and ROUND_IGNORE its truncation toward zero. Every stored result shall be finite and representable. No exponent shall cause an invalid native shift, including one equal to or greater than the storage width.
A successful result shall report a relation containing the exact rational quotient's ordering relative to the stored integer. With ROUND_STRICT_RELATION it shall return precisely V_EQ, V_GT or V_LT for equality, an exact quotient greater than the stored result, or one smaller than it. ROUND_NOT_NEEDED shall require exact divisibility by 2e; it shall store the exact quotient and return a relation admitting equality. Its strict form shall return V_EQ.
An exponent of zero shall preserve the integer value. For exponents greater than the storage width, a nonzero positive source shall have floor zero and ceiling one; a negative source shall have floor minus one and ceiling zero. Delegated truncation shall give zero in both cases. Zero shall remain zero for every exponent. Source aliases, preservation, handler independence, initialization, synchronization and hardware-direction conditions shall follow 🔗 1. Exact same-storage native integer arithmetic.
RATIONALE: Integer division by a power of two must retain its directed mathematical meaning beyond the native shift width, including negative fractions and exactness classification.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for admitted argument types:
Result div_2exp_assign_r(To& to, const From& source, unsigned int e, Rounding_Dir dir);
VERIFICATION_CRITERIA: Derive exact quotient/remainder, directed integer and relation oracles using unbounded arithmetic or symbolic signs for very large exponents. Exercise all eleven storage types, every valid request, signed zero-crossing cases, finite endpoints, exact divisibility and exponents through UINT_MAX. Check same-object assignment, raw/checked forms, unchanged sources and hardware direction without library initialization.
SOURCE: src/checked_int_inlines.hh; src/checked_ext_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; tests/nativeintegerdyadicspec1.cc.
-
Incoming link from: 6. Checked named nonnegative square root1
1. Directed native integer square-root assignment UID: PPL-SPEC-000840 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the eleven standard native integer storage types and same-storage raw/checked forms in 🔗 1. Exact same-storage native integer arithmetic, a finite nonnegative source x shall be admitted by sqrt_assign_r. ROUND_DOWN shall store ⌊√(x)⌋; ROUND_UP shall store ⌈√(x)⌉. ROUND_IGNORE shall use the floor convention. The result shall be finite and representable, including when forming its mathematical square or its successor's square would exceed native storage.
The returned relation shall contain the exact nonnegative real square root's ordering relative to the stored integer. With ROUND_STRICT_RELATION it shall identify exactly equality, strict greater-than or strict less-than through V_EQ, V_GT or V_LT. ROUND_NOT_NEEDED shall require a perfect-square source, store its exact integer root and return a relation admitting equality; its strict form shall return V_EQ. Zero and one shall have their exact roots. No negative-input rejection guarantee shall be inferred from the nonnegative domain.
The source and destination may be the same object; distinct sources shall remain unchanged. Calls shall require no rounding default, policy handler, floating-point conversion, FPU setup, irrational-precision setting or library initialization. They shall not invoke a result handler and shall preserve hardware direction. Live-object and synchronization prerequisites shall follow 🔗 1. Exact same-storage native integer arithmetic.
RATIONALE: An integer root can be computed and checked exactly without an inexact floating conversion or a native-width square used as an oracle.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for admitted argument types:
Result sqrt_assign_r(To& to, const From& source, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use independent unbounded integer root/remainder oracles and both root inequalities, every nonnegative eight-bit input, all native storage types, large perfect squares and their neighbors, finite maxima, raw/checked forms and source aliases. Check each admitted rounding/exactness request, result relation, unchanged sources and hardware direction without initialization.
SOURCE: src/checked_int_inlines.hh; src/checked_inlines.hh; src/checked_ext_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; tests/nativeintegerfunctionspec1.cc.
-
Incoming links from: 4. Typed special-value assignment to native floating-point storage 1. Supported exact integer and rational conversion to native floating storage 1. Finite native floating-point floor, ceiling and truncation 1. Exact conversion between native and checked integral scalars 2. Exact conversion from an unbounded integer to integral storage 4. Truncated rational-to-integral conversion and lazy relation requests 1. Exact native integral and unbounded integer assignment to mpz storage7
4. Rounding-direction intent, composition and inspection UID: PPL-SPEC-000124 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: ROUND_DOWN and ROUND_UP shall request bounds toward negative and positive infinity, respectively. ROUND_IGNORE shall delegate rounding and permit lazily evaluated relation information; ROUND_NATIVE shall be its alias. ROUND_NOT_NEEDED shall require the caller to ensure that the requested operation's result is exact and representable in its destination. ROUND_STRICT_RELATION shall request determination of the exact ordering relation rather than a weaker relation containing it. ROUND_DIRECT and ROUND_INVERSE shall alias ROUND_UP and ROUND_DOWN, respectively.
A supported direction shall contain one of the four base directions with an optional strict-relation flag. Bitwise operator& and operator| shall intersect and unite direction bits. round_dir shall retain exactly the ROUND_DIR_MASK bits. Each named direction predicate shall return true exactly when that base direction is selected, independently of the strict flag. round_not_requested shall return true exactly for ROUND_IGNORE or ROUND_NOT_NEEDED. round_strict_relation shall return true exactly when the strict-relation bit is present. These operations shall preserve the arguments, require no initialized library state and leave the hardware rounding state unchanged.
For constant-evaluable inputs, these operations shall support constant evaluation under the same stated preconditions.
RATIONALE: Rounding requests are numerical preconditions and intent, rather than instructions to change hardware state at every inspection. The strict flag is independent of the requested bound direction.
INTERFACE: Public header: <ppl.hh>; PPL declarations:
enum Rounding_Dir { ROUND_DOWN = 0U, ROUND_UP = 1U, ROUND_IGNORE = 6U, ROUND_NATIVE = ROUND_IGNORE, ROUND_NOT_NEEDED = 7U, ROUND_DIRECT = ROUND_UP, ROUND_INVERSE = ROUND_DOWN, ROUND_DIR_MASK = 7U, ROUND_STRICT_RELATION = 8U, ROUND_CHECK = ROUND_DIRECT | ROUND_STRICT_RELATION }; constexpr Rounding_Dir operator&(Rounding_Dir x, Rounding_Dir y); constexpr Rounding_Dir operator|(Rounding_Dir x, Rounding_Dir y); constexpr Rounding_Dir round_dir(Rounding_Dir dir); constexpr bool round_down(Rounding_Dir dir); constexpr bool round_up(Rounding_Dir dir); constexpr bool round_ignore(Rounding_Dir dir); constexpr bool round_not_needed(Rounding_Dir dir); constexpr bool round_not_requested(Rounding_Dir dir); constexpr bool round_direct(Rounding_Dir dir); constexpr bool round_inverse(Rounding_Dir dir); constexpr bool round_strict_relation(Rounding_Dir dir);
VERIFICATION_CRITERIA: Exhaust all four supported base directions with and without the strict flag. Check every predicate against a literal truth table, bitwise composition and exact return types; test both short-circuit conditions of round_not_requested. Preserve the hardware state across pure enum operations. Check the constant-expression operations with translation-time assertions in addition to the runtime contract tests.
SOURCE: src/Rounding_Dir_defs.hh and src/Rounding_Dir_inlines.hh; tests/numericprotocols1.cc; tests/numericpublic1.cc.
-
5. Inversion of a supported rounding bound direction UID: PPL-SPEC-000125 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For ROUND_UP or ROUND_DOWN, optionally combined with ROUND_STRICT_RELATION, inverse(dir) shall exchange upward and downward rounding and preserve the strict flag. ROUND_IGNORE, with or without that flag, shall be its own inverse. Applying inverse twice shall restore the supplied supported direction.
The base ROUND_NOT_NEEDED shall not be an admitted input to this operation. The function shall preserve its argument and shall not inspect or change hardware rounding state. It shall require no initialized library state.
For constant-evaluable inputs, these operations shall support constant evaluation under the same stated preconditions.
RATIONALE: Inverting a bound exchanges its safe direction while preserving requested precision of the reported relation. A no-rounding-needed precondition is not a bound direction to invert.
INTERFACE: Public header: <ppl.hh>; declaration in PPL:
constexpr Rounding_Dir inverse(Rounding_Dir dir);
VERIFICATION_CRITERIA: Check the six admitted values against literal inverse answers, strict-flag preservation, the involution identity and unchanged hardware rounding. Keep invalid direction values and ROUND_NOT_NEEDED outside successful-use tests. Check the constant-expression operations with translation-time assertions in addition to the runtime contract tests.
SOURCE: src/Rounding_Dir_defs.hh and src/Rounding_Dir_inlines.hh; tests/numericprotocols1.cc.
-
6. Mapping a bound direction to the platform FPU encoding UID: PPL-SPEC-000126 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: When PPL_CAN_CONTROL_FPU is nonzero, round_fpu_dir(dir) shall map ROUND_UP and ROUND_DOWN to the configured platform encodings for upward and downward FPU rounding, respectively. An optional ROUND_STRICT_RELATION flag shall not change that encoding. Only those two base directions shall be admitted. The mapping shall not set, inspect or otherwise change FPU state and shall require no initialized library state.
No callable definition shall be promised when PPL_CAN_CONTROL_FPU is zero. In that configuration, callers shall not invoke this mapping.
For constant-evaluable inputs, these operations shall support constant evaluation under the same stated preconditions.
RATIONALE: The abstract rounding request and the platform control-word encoding have separate representations. A pure conversion between them must not acquire ownership of the FPU state.
INTERFACE: Public header: <ppl.hh>; configured PPL interface:
constexpr fpu_rounding_direction_type round_fpu_dir(Rounding_Dir dir);
The implementation shall be available under the configuration condition stated above.
VERIFICATION_CRITERIA: When FPU control is configured, compare both bound directions with independently captured platform constants, with and without the strict flag, and verify that the current hardware state is preserved. Compile a no-control configuration without invoking the unavailable definition. Check the constant-expression operations with translation-time assertions in addition to the runtime contract tests.
SOURCE: src/Rounding_Dir_defs.hh and src/Rounding_Dir_inlines.hh; tests/numericprotocols1.cc.
-
3. Numeric text input into integral destinations UID: PPL-SPEC-000527 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
- PPL-LLR-000446 Reloadable textual representations (Specifies)
STATEMENT: For a successfully parsed finite token of exact value q in 🔗 1. Exact finite numeric token syntax, input into each native integer or Checked_Number<I, Check_Overflow_Policy<I>> type admitted in 🔗 3. Directed rational-to-integral conversion within range shall apply the canonical rational conversion rules in 🔗 3. Directed rational-to-integral conversion within range, 🔗 4. Truncated rational-to-integral conversion and lazy relation requests and 🔗 6. Rational conversion at and beyond integral endpoints, with the same destination value, range outcome, result relation and exactness precondition. Input into mpz_class shall use 🔗 2. Directed canonical rational conversion to an unbounded integer and 🔗 3. Delegated and exactness rational conversion to an unbounded integer. In particular, directed requests shall use floor/ceiling and delegated integer conversion shall truncate toward zero; ROUND_NOT_NEEDED shall require an integral finite token value representable in the selected destination.
Token precision shall not first be restricted to the configured coefficient range or to a native floating type. Named input shall return the numeric conversion result without automatically dispatching a policy error handler. The token shall remain consumed if subsequent numeric conversion reports an unrepresentable result. Stream behavior, source synchronization and resources shall follow 🔗 2. Canonical rational input and stream failure outcomes. Shared rational temporary pools shall be serialized in a build without thread-safe support; thread-safe builds shall use calling-thread pools. Destination and initialization prerequisites shall follow the corresponding conversion contracts, without requiring an FPU merely to parse or round a rational into integral storage.
RATIONALE: Exact token semantics avoid intermediate floating or configured-coefficient rounding. A proven range outcome can be determined before large powers are expanded.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library for the admitted numeric types:
Result input(To& to, std::istream& stream, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use exact token fractions around integer zero, signed/unsigned endpoints and large MPZ values. Check floor, ceiling, delegated truncation, weak/strict results, admitted exactness requests, out-of-range reports, consumed tokens and destination reuse for all native integer and checked forms in every coefficient configuration.
SOURCE: src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_inlines.hh; src/checked_int_inlines.hh; src/checked_mpz_inlines.hh; src/checked.cc; tests/numberinput1.cc; tests/numerictextspec1.cc.
-
4. Numeric text input into supported native floating destinations UID: PPL-SPEC-000528 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
- PPL-LLR-000446 Reloadable textual representations (Specifies)
STATEMENT: For a successfully parsed finite token of exact rational value q, input into raw or Checked_Number<F, Check_Overflow_Policy<F>> storage shall apply the value, direction, exactness and range rules in 🔗 1. Supported exact integer and rational conversion to native floating storage, 🔗 2. Directed conversion to adjacent finite normal floating-point bounds, 🔗 3. Directed conversion in the subnormal and underflow range, 🔗 4. Delegated and exactness requests for floating-point conversion and 🔗 5. Floating conversion overflow thresholds and computed-value classes for the corresponding configured supported native format. The returned relation shall compare q with the stored native value. Strict requests shall retain the precision of that rational conversion; native token parsing shall not round through a narrower intermediate format or the configured coefficient type.
A lexical negative-zero token shall parse as rational zero and therefore store positive native zero. Nonzero negative underflow shall retain the negative sign required by the rational conversion. Named input shall return its numeric outcome directly, without policy handler dispatch. Stream consumption/failure and temporary-pool prerequisites shall follow 🔗 3. Numeric text input into integral destinations. No library initialization owner, coefficient-constant stage or irrational-precision setting shall be needed, and hardware direction shall not change. Native format availability and any arithmetic conditions shall follow the cited rational conversion contracts.
RATIONALE: Using the exact token rational as the floating conversion source prevents double rounding and distinguishes mathematical zero from a nonzero value underflowing to signed zero.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library for the admitted numeric types:
Result input(To& to, std::istream& stream, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check exact dyadics, decimal fractions, half-ULP neighbors, subnormal endpoints and native finite-range limits with independent rational oracles. Cross all supported formats/raw-checked destinations, directions and strict statuses, verify lexical versus underflow zero signs, exactness cases and hardware preservation.
SOURCE: src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_inlines.hh; src/checked_float_inlines.hh; src/checked.cc; tests/numberinput1.cc; tests/numerictextspec1.cc.
-
Incoming links from: 2. Rectilinear distance of octagonal closed-bound tables 2. Rectilinear distance of octagonal closed-bound tables 3. Euclidean distance of octagonal closed-bound tables 3. Euclidean distance of octagonal closed-bound tables 4. Maximum-coordinate distance of octagonal closed-bound tables 4. Maximum-coordinate distance of octagonal closed-bound tables6
1. Octagonal distance normalization, boundaries and workspaces UID: PPL-SPEC-001230 STATUS: APPROVED COMPONENT: OCTAGONS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000061 Octagonal expressiveness (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000303 Preservation by representation-only changes (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a nonempty shape of ambient dimension n, let z2k = xk and z2k + 1 = − xk for 0 ≤ k < n. The stored position (i, j) shall describe zj − zi ≤ bij. Let pi be zero for even i and one for odd i. The distance tuple shall contain exactly
Dn = {(i, j) ∣ 0 ≤ i < 2n, 0 ≤ j < i + 2 − pi}.This is the physical pseudo-triangular domain of 🔗 1. Pseudo-triangular matrix values and physical coordinates, with 2n(n + 1) positions. Its 2n diagonal positive-infinity sentinels shall each contribute zero. Its 2n2 other positions shall count each signed octagonal normal once: ±2xk for unary bounds and ±xk±xl for k < l. Unary bounds shall remain doubled in the tuple; the coherently equivalent matrix position shall not be counted again. A positive-infinite bound shall impose no restriction.
The selected tables shall be those used after the call's required strong closure. With exact rational closure, finite entries shall be the primitive suprema of the represented set, with infinity for unbounded forms. Rounded or saturating closure, including integer halving, shall retain 🔗 1. Octagonal values, numerical profiles and valid use; selected tables need not be canonical, idempotent or invariant across alternative source descriptions. The distance shall use these selected tables, as retained in compatible post-call records of 🔗 1. Reloadable octagonal record export. It shall not denote minimum point separation or a Hausdorff distance. Normalization shall preserve each source's represented set and ambient dimension.
Different ambient dimensions shall return false before modifying the result or supplied workspaces. False shall assign no distance for that pair. Dimension-compatible two-empty shapes shall have distance zero; exactly one empty shape shall have positive-infinite distance. In dimension zero, two universe shapes shall also have distance zero. These rules shall apply to logically empty sources whose emptiness has not yet been classified. Equal dimensions shall return true on successful numerical completion, with the value specified by 🔗 2. Rectilinear distance of octagonal closed-bound tables, 🔗 3. Euclidean distance of octagonal closed-bound tables or 🔗 4. Maximum-coordinate distance of octagonal closed-bound tables.
The overload without an explicit temporary type shall use three Checked_Number<To,Extended_Number_Policy> workspaces. The overload with an explicit scalar Temp argument shall use three Checked_Number<Temp,Extended_Number_Policy> workspaces. The supplied-workspace overload shall use the actual type of its three references, which may be an admitted raw or checked numeric type. The supported operation, rounding, representation and overlap conditions of 🔗 20. Distance scratch storage, admissible overlaps and numeric conditions and 🔗 9. Distance workspace protocol and admissible overlaps shall apply to the selected metric specialization, subject to the public source-storage condition below.
Calls evaluating finite entry differences shall use ROUND_DOWN or ROUND_UP, optionally combined with ROUND_STRICT_RELATION. Finite source conversions shall not have to be exact merely to establish the requested directed bound. Paths performing only exact zero or positive- infinity assignments shall admit directions valid for those selected scalar assignments. An output profile shall support positive infinity whenever that outcome is reachable. Every conversion, difference, sum, square, square root and final assignment shall satisfy its selected backend's arithmetic, range, numerical-failure, resource, initialization and nontrapping prerequisites. Native arithmetic shall retain configured support and initialized caller-owned FPU conditions; the call shall preserve caller rounding. Rational square-root precision shall remain stable throughout a dependent call.
Sources shall be live valid objects under 🔗 1. Octagonal values, numerical profiles and valid use. The same shape may be supplied for both operands. The three mutable supplied workspaces shall be live, pairwise distinct and disjoint from source-owned storage. Their entry values need not have mathematical significance when overwritten before reading. The result shall have live assignable storage disjoint from source-owned storage, but may overlap one supplied workspace or its compatible underlying raw storage. When the result overlaps a workspace, the distance shall still use source values on entry. Callers shall preserve object/storage lifetimes and synchronize source access, including logically const cache updates.
Numerical and recoverable resource failures shall retain their selected propagation channels and permitted partial result/workspace states; no aggregate rollback guarantee shall be inferred. Discarded owned temporaries shall be released, while reusable numerical cache storage shall retain its own lifetime and cleanup contract. Ordinary dimension mismatch shall retain the stronger unchanged-result/workspace guarantee above. Otherwise valid calls shall require no additional library initialization beyond their selected representation, numerical and thread runtime prerequisites.
RATIONALE: A bound-array metric needs an explicit normalization convention, source carrier and numeric protocol. Exact semantic support tuples and rounded representation tuples have different invariance properties, while their empty/dimension outcomes and storage obligations remain explicit.
INTERFACE: Public header: <ppl.hh>. This protocol applies to all nine free function overloads declared in 🔗 2. Rectilinear distance of octagonal closed-bound tables, 🔗 3. Euclidean distance of octagonal closed-bound tables and 🔗 4. Maximum-coordinate distance of octagonal closed-bound tables, in Parma_Polyhedra_Library. Their result, shape, rounding and optional three-workspace parameters retain those exact signatures.
template <typename Temp, typename To, typename T> bool rectilinear_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2); template <typename Temp, typename To, typename T> bool euclidean_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2); template <typename Temp, typename To, typename T> bool l_infinity_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Verify independent rational support closure, rounded selected-table norms and before/after denotation equality separately. Cover all nine forms, cold/classified/widened histories, lazy emptiness, zero dimensions, one-sided infinities, mismatched dimensions and unchanged sentinels. Test same-owner inputs, result aliases to each raw/checked workspace, different temporary/result profiles, required initialized native modes and caller-mode preservation. Measure and exercise meaningful allocation/cleanup paths, distinguishing C++ new/new[] observation from backend GMP allocation failures.
BIBLIOGRAPHY: BagnaraHZ09FMSD | Section 4, coherent signed-variable encoding and Definition 5 of strong closure (PDF page indices 9–10, zero-based).
SOURCE: src/Octagonal_Shape_defs.hh; src/Octagonal_Shape_inlines.hh; src/Octagonal_Shape_templates.hh; src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/octagonalshapedistancespec1.cc; tests/octagonalshapedistanceoracle.hh; tests/octagonalshapevalueoracle.hh; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/octagonalshapedistancepublic1.cc; tests/shapemetricboundaries1.cc; tests/octagonalshapedistancefailure1.cc; tests/boxallocationfixture.hh; tests/octagonalshapesaturationspec1.cc.
-
2. Rectilinear distance of octagonal closed-bound tables UID: PPL-SPEC-001231 STATUS: APPROVED COMPONENT: OCTAGONS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000061 Octagonal expressiveness (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: Under 🔗 1. Octagonal distance normalization, boundaries and workspaces, the three rectilinear_distance_assign overloads shall assign the requested directed approximation of the distance between the selected closed bound tables of their dimension-compatible operands. If both shapes are nonempty, corresponding finite bounds shall contribute dij = |bij(X) − bij(Y)|. Two positive-infinite entries shall contribute zero; exactly one positive infinity at any corresponding position shall make the distance positive infinity.
For the physical tuple Dn defined by 🔗 1. Octagonal distance normalization, boundaries and workspaces and finite corresponding differences, the exact distance shall be ∑(i, j) ∈ Dndij, with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001230].
On successful numerical completion the operation shall return true. An upward result shall not be smaller than the exact selected-table distance and a downward result shall not be larger. A true Boolean shall not imply exactness or the best representable rounded bound. Valid inexact conversions to the selected temporary type shall retain these directed guarantees. The accumulation and finalization shall retain 🔗 6. Rectilinear distance of physical octagonal entry arrays.
RATIONALE: The sum of absolute corresponding bound changes compares the selected signed-bound descriptions while retaining an explicit mathematical meaning and numerical direction.
INTERFACE: Public header: <ppl.hh>; free functions in Parma_Polyhedra_Library:
template <typename To, typename T> bool rectilinear_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool rectilinear_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool rectilinear_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: For exact rational closure, compute signed primitive suprema independently from rational conjunctions. For rounded profiles, decode the selected post-call physical tuples independently and check source-set preservation separately. Compare all three overload forms with exact tuple norms. Include translated nonzero operands, signed differences, infinity positions, identical owners, zero/empty cases and incompatible dimensions. Exercise exact and inexact temporary/result conversions, admitted aliases and supported configurations; verify source preservation and caller rounding. For rectilinear results compare the independent sum of absolute entry differences, including translated operands and differently signed entries.
SOURCE: src/Octagonal_Shape_defs.hh; src/Octagonal_Shape_inlines.hh; src/Octagonal_Shape_templates.hh; src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/octagonalshapedistancespec1.cc; tests/octagonalshapedistanceoracle.hh; tests/octagonalshapevalueoracle.hh; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/octagonalshapedistancepublic1.cc; tests/shapemetricboundaries1.cc; tests/octagonalshapesaturationspec1.cc.
-
3. Euclidean distance of octagonal closed-bound tables UID: PPL-SPEC-001232 STATUS: APPROVED COMPONENT: OCTAGONS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000061 Octagonal expressiveness (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: Under 🔗 1. Octagonal distance normalization, boundaries and workspaces, the three euclidean_distance_assign overloads shall assign the requested directed approximation of the distance between the selected closed bound tables of their dimension-compatible operands. If both shapes are nonempty, corresponding finite bounds shall contribute dij = |bij(X) − bij(Y)|. Two positive-infinite entries shall contribute zero; exactly one positive infinity at any corresponding position shall make the distance positive infinity.
For the physical tuple Dn defined by 🔗 1. Octagonal distance normalization, boundaries and workspaces and finite corresponding differences, the exact distance shall be √(∑(i, j) ∈ Dnd 2ij), with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001230].
On successful numerical completion the operation shall return true. An upward result shall not be smaller than the exact selected-table distance and a downward result shall not be larger. A true Boolean shall not imply exactness or the best representable rounded bound. Valid inexact conversions to the selected temporary type shall retain these directed guarantees. The accumulation and finalization shall retain 🔗 7. Euclidean distance of physical octagonal entry arrays.
Rational square-root enclosure shall retain 🔗 2. Finite rational square root at the selected irrational precision and the calling precision of 🔗 3. Selection and ownership of irrational rational precision, which shall remain stable throughout the dependent call.
RATIONALE: The square root of the sum of squared bound changes compares the selected signed-bound descriptions while retaining an explicit mathematical meaning and numerical direction.
INTERFACE: Public header: <ppl.hh>; free functions in Parma_Polyhedra_Library:
template <typename To, typename T> bool euclidean_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool euclidean_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool euclidean_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: For exact rational closure, compute signed primitive suprema independently from rational conjunctions. For rounded profiles, decode the selected post-call physical tuples independently and check source-set preservation separately. Compare all three overload forms with exact tuple norms. Include translated nonzero operands, signed differences, infinity positions, identical owners, zero/empty cases and incompatible dimensions. Exercise exact and inexact temporary/result conversions, admitted aliases and supported configurations; verify source preservation and caller rounding. For Euclidean results compare exact rational squares and test rational precision, rather than using a rounded reference square root.
SOURCE: src/Octagonal_Shape_defs.hh; src/Octagonal_Shape_inlines.hh; src/Octagonal_Shape_templates.hh; src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/octagonalshapedistancespec1.cc; tests/octagonalshapedistanceoracle.hh; tests/octagonalshapevalueoracle.hh; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/octagonalshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.
-
4. Maximum-coordinate distance of octagonal closed-bound tables UID: PPL-SPEC-001233 STATUS: APPROVED COMPONENT: OCTAGONS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000061 Octagonal expressiveness (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000133 Failure and resource safety (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: Under 🔗 1. Octagonal distance normalization, boundaries and workspaces, the three l_infinity_distance_assign overloads shall assign the requested directed approximation of the distance between the selected closed bound tables of their dimension-compatible operands. If both shapes are nonempty, corresponding finite bounds shall contribute dij = |bij(X) − bij(Y)|. Two positive-infinite entries shall contribute zero; exactly one positive infinity at any corresponding position shall make the distance positive infinity.
For the physical tuple Dn defined by 🔗 1. Octagonal distance normalization, boundaries and workspaces and finite corresponding differences, the exact distance shall be max(i, j) ∈ Dndij, with zero for an empty tuple. The zero-dimensional, empty and dimension-incompatible cases shall follow [LINK: PPL-SPEC-001230].
On successful numerical completion the operation shall return true. An upward result shall not be smaller than the exact selected-table distance and a downward result shall not be larger. A true Boolean shall not imply exactness or the best representable rounded bound. Valid inexact conversions to the selected temporary type shall retain these directed guarantees. The accumulation and finalization shall retain 🔗 8. Maximum-coordinate distance of physical octagonal entry arrays.
RATIONALE: The largest absolute corresponding bound change compares the selected signed-bound descriptions while retaining an explicit mathematical meaning and numerical direction.
INTERFACE: Public header: <ppl.hh>; free functions in Parma_Polyhedra_Library:
template <typename To, typename T> bool l_infinity_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool l_infinity_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir); template <typename Temp, typename To, typename T> bool l_infinity_distance_assign( Checked_Number<To, Extended_Number_Policy>& r, const Octagonal_Shape<T>& x, const Octagonal_Shape<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: For exact rational closure, compute signed primitive suprema independently from rational conjunctions. For rounded profiles, decode the selected post-call physical tuples independently and check source-set preservation separately. Compare all three overload forms with exact tuple norms. Include translated nonzero operands, signed differences, infinity positions, identical owners, zero/empty cases and incompatible dimensions. Exercise exact and inexact temporary/result conversions, admitted aliases and supported configurations; verify source preservation and caller rounding. For maximum-coordinate results identify the exact greatest absolute entry difference independently and exercise both first and later maximum updates.
SOURCE: src/Octagonal_Shape_defs.hh; src/Octagonal_Shape_inlines.hh; src/Octagonal_Shape_templates.hh; src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/distances_defs.hh; src/distances_inlines.hh; src/globals_defs.hh; doc/definitions.dox; tests/octagonalshapedistancespec1.cc; tests/octagonalshapedistanceoracle.hh; tests/octagonalshapevalueoracle.hh; tests/bdshapedistanceoracle.hh; tests/bdshapeconversionoracle.hh; tests/bdshapevalueoracle.hh; tests/boxrefinementoracle.hh; tests/boxsetoracle.hh; tests/octagonalshapedistancepublic1.cc; tests/shapemetricboundaries1.cc.
-
4. Pointwise upward representation conversion UID: PPL-SPEC-000774 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Cross-element-type construction shall create an independently owned matrix of the source space dimension. Each physical coordinate shall follow the upward conversion of 🔗 7. Pointwise upward conversion of extended-number rows: finite results shall bound the exact source upward, exactly representable values shall remain exact, and supported extended values shall retain their meanings. The source shall remain unchanged. Empty sources shall produce empty targets. Selected source/target profiles shall admit the conversions and all required intermediates. Failure shall retain 🔗 20. Incomplete-owner cleanup and mutation failure states.
RATIONALE: Changing the representation of stored bounds requires directed conversion at every actual pseudo-triangular coordinate.
INTERFACE: Internal source header: OR_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to OR_Matrix<T> unless an indicated nested type or free function owns the declaration. Nested aliases retain their source-declared dependent types.
template <typename U> explicit OR_Matrix(const OR_Matrix<U>& y);
VERIFICATION_CRITERIA: Use independent GMP ceilings for signed rational-to-integral conversion at every physical coordinate, exact rational conversions, infinities, empty matrices and source preservation.
SOURCE: src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/OR_Matrix_templates.hh; tests/ormatrixspec1.cc; tests/ormatrixiteratorhistories1.cc.
-
Incoming link from: 2. Rectilinear distance of octagonal closed-bound tables1
6. Rectilinear distance of physical octagonal entry arrays UID: PPL-SPEC-000796 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: With the conditions of 🔗 9. Distance workspace protocol and admissible overlaps, rectilinear distance shall return false on unequal space dimensions without modifying result or workspaces. For equal dimensions it shall return true and assign the requested directed approximation of ∑(k, j) ∈ Dndkj, where Dn is exactly the physical coordinate domain of 🔗 1. Pseudo-triangular matrix values and physical coordinates and each finite dkj is the absolute difference of the entry values on call entry. Equal positive infinities shall contribute zero; exactly one positive infinity at any stored coordinate shall make the distance positive infinity. Empty equal-dimensional matrices shall have distance zero.
Accumulation and result conversion shall retain the selected profile's rounding guarantees: successful upward bounds shall be no smaller than the exact sum and downward bounds no larger. Source entries shall be preserved except where the admitted result output overlaps an entry. Reported numerical/resource failures shall not be true results.
RATIONALE: A physical bound-entry norm counts each stored coordinate once; it is not a distance between represented octagonal geometric sets.
INTERFACE: Internal source header: OR_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; unqualified members apply to OR_Matrix<T>. The stream insertion operator belongs to its IO_Operators namespace.
template <typename Temp, typename To, typename T> bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r, const OR_Matrix<T>& x, const OR_Matrix<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Use independent rational sums with differences at every stored coordinate, all shared/one-sided infinity cases, empty/dimension mismatch, symmetry and supported result overlaps.
SOURCE: src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/OR_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/ormatrixoperationsspec1.cc; tests/ormatrixiteratorhistories1.cc; tests/rawmatrixmetricshistories1.cc.
-
Incoming link from: 3. Euclidean distance of octagonal closed-bound tables1
7. Euclidean distance of physical octagonal entry arrays UID: PPL-SPEC-000797 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: With the conditions of 🔗 9. Distance workspace protocol and admissible overlaps, Euclidean distance shall return false on unequal space dimensions without modifying result or workspaces. For equal dimensions it shall return true and assign the requested directed approximation of √(∑(k, j) ∈ Dnd 2kj), using exactly the physical coordinate domain of 🔗 1. Pseudo-triangular matrix values and physical coordinates and finite absolute entry differences on call entry. Equal positive infinities shall contribute zero; exactly one positive infinity at any stored coordinate shall make the distance positive infinity. Empty equal-dimensional matrices shall have distance zero.
Accumulation, square root and result conversion shall retain the selected profile's directed enclosure guarantees. Rational square-root bounds shall retain 🔗 2. Finite rational square root at the selected irrational precision and the context precision of 🔗 3. Selection and ownership of irrational rational precision, without promising every rational perfect square is exact on the selected grid. Source entries shall be preserved except where the admitted result output overlaps an entry. Reported failures shall not be true results.
RATIONALE: The entry-array Euclidean norm needs both a fixed physical coordinate count and the selected square-root enclosure semantics.
INTERFACE: Internal source header: OR_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; unqualified members apply to OR_Matrix<T>. The stream insertion operator belongs to its IO_Operators namespace.
template <typename Temp, typename To, typename T> bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r, const OR_Matrix<T>& x, const OR_Matrix<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Compare literal Pythagorean families at all stored coordinates with independently calculated rational-grid bounds, integer/native sqrt(2) enclosures, infinity/empty/dimension cases and supported result overlaps.
SOURCE: src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/OR_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/ormatrixoperationsspec1.cc; tests/ormatrixiteratorhistories1.cc; tests/rawmatrixmetricshistories1.cc.
-
Incoming link from: 4. Maximum-coordinate distance of octagonal closed-bound tables1
8. Maximum-coordinate distance of physical octagonal entry arrays UID: PPL-SPEC-000798 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: With the conditions of 🔗 9. Distance workspace protocol and admissible overlaps, maximum-coordinate distance shall return false on unequal space dimensions without changing result or workspaces. For equal dimensions it shall return true and assign the requested directed approximation of max(k, j) ∈ Dndkj, using exactly the physical coordinate domain of 🔗 1. Pseudo-triangular matrix values and physical coordinates and finite absolute entry differences on call entry. Equal positive infinities shall contribute zero; exactly one positive infinity at any stored coordinate shall make the distance positive infinity. Empty equal-dimensional matrices shall have distance zero.
Coordinate difference, maximum and result conversion shall retain the selected profile's directed guarantees. Source entries shall be preserved except where the admitted result output overlaps an entry. Reported numerical/resource failures shall not be true results.
RATIONALE: A maximum over physical bound entries must visit every stored row and column without introducing unstored symmetric coordinates.
INTERFACE: Internal source header: OR_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; unqualified members apply to OR_Matrix<T>. The stream insertion operator belongs to its IO_Operators namespace.
template <typename Temp, typename To, typename T> bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r, const OR_Matrix<T>& x, const OR_Matrix<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Compare independent coordinate maxima with differences at every stored coordinate, symmetry, all infinity cases, empty/dimension mismatch and admitted result overlaps.
SOURCE: src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/OR_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/ormatrixoperationsspec1.cc; tests/ormatrixiteratorhistories1.cc; tests/rawmatrixmetricshistories1.cc.
-
9. Distance workspace protocol and admissible overlaps UID: PPL-SPEC-000799 STATUS: APPROVED COMPONENT: CORE_DATA_STRUCTURES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Distance operations shall require valid matrices of admitted finite or positive-infinite entries, supported rounding directions and temporary/ result profiles supporting every required conversion, subtraction, accumulation, square-root or maximum operation. Negative infinity and NaN shall remain outside these metric domains. Every intermediate shall satisfy the selected arithmetic, precision and resource prerequisites. Initialization and synchronization shall retain 🔗 3. Thread initialization, default state and finalization where required.
The three mutable workspaces shall be pairwise distinct and independent of matrix coefficients; their values may be overwritten. The result may be independent, overlap one workspace when types permit, or overlap one live input entry while all workspaces remain independent. Results shall use input values on entry. Identical matrix owners may be passed as both inputs. Dimension mismatch shall precede any result/workspace update. Other failures shall retain the selected numerical policy's permitted output states without a universal rollback guarantee. The generic helper shall apply these conditions with the library's rectilinear, Euclidean or maximum-coordinate specialization for the same temporary type.
RATIONALE: Exact input-value and scratch alias rules are necessary for sound results when callers supply reusable workspaces.
INTERFACE: Internal source header: OR_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; unqualified members apply to OR_Matrix<T>. The stream insertion operator belongs to its IO_Operators namespace.
template <typename Specialization, typename Temp, typename To, typename T> bool l_m_distance_assign(Checked_Number<To, Extended_Number_Policy>& r, const OR_Matrix<T>& x, const OR_Matrix<T>& y, Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA: Exercise result overlap with each workspace and source entries, identical owners, unchanged result/workspaces on dimension mismatch and supported exact/native temporary profiles.
SOURCE: src/OR_Matrix_defs.hh; src/OR_Matrix_inlines.hh; src/OR_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/ormatrixoperationsspec1.cc; tests/ormatrixiteratorhistories1.cc; tests/rawmatrixmetricshistories1.cc.
-
3. Weakly relational extended-number policies UID: PPL-SPEC-001641 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Both WRD_Extended_Number_Policy and Debug_WRD_Extended_Number_Policy shall enable overflow checks, NaN and infinity representations, and requested FPU inexact checks. The production policy shall disable checks for opposite-infinity addition, same-infinity subtraction, infinity-times-zero, division by zero, infinity division, infinite remainder, negative square root and extra FPU NaN-result detection. The debugging policy shall enable all those checks.
Neither policy shall define convertible or any of the five ROUND_DEFAULT_* members. Operations needing them shall require an explicitly suitable policy instead of silently selecting a default. handle_result(r) shall forward exactly results whose class is VC_NAN to throw_result_exception(r) and propagate the resulting exception. Every normal or infinity result shall be accepted without an exception, including normal-class results carrying overflow or unrepresentable flags. The policies shall require no library initialization or rounding-mode change. Arithmetic using these policies shall retain its own numerical prerequisites; disabled checks shall not authorize undefined mathematical operations.
RATIONALE: Weakly relational algorithms explicitly control rounding and use infinity bounds; policy capabilities and debugging diagnostics must not be mistaken for implicit defaults.
INTERFACE: Names belong to Parma_Polyhedra_Library unless qualified otherwise. Template excerpts omit SFINAE return-type restrictions described in the text.
struct WRD_Extended_Number_Policy; struct Debug_WRD_Extended_Number_Policy; // Member of each policy: static void handle_result(Result);
VERIFICATION_CRITERIA: Check every policy constant, absence of conversion/default-rounding members and every defined result category, including overflow/unrepresentable flags. Compare forwarded NaN exception types with throw_result_exception and require acceptance of normal/infinity categories.
SOURCE: src/WRD_coefficient_types_defs.hh; src/WRD_coefficient_types_inlines.hh; tests/scalaradaptersspec1.cc.
-
4. Interval and scalar view adapters UID: PPL-SPEC-001642 STATUS: APPROVED COMPONENT: INTERVALS_BOXES APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For a live initialized interval, f_is_empty, f_is_singleton and infinity_sign shall return the corresponding member query. In Interval_NS, f_lower, f_upper and f_info shall return const references to the interval's owned boundaries and metadata, preserving reference identity and the access conditions of 🔗 2. Interval endpoint and metadata references.
For an admitted singleton scalar x, the two boundary adapters shall return const references to x itself. Its metadata adapter shall return a shared immutable null-information object admitting empty values and infinity, with inexact checking disabled. The overload with bool open shall return independent null-information metadata whose two boundaries have that openness. The scalar empty predicate shall return exactly is_not_a_number(x); its singleton predicate shall negate that result.
is_singleton_integer(x) shall return true exactly when the interval or scalar is a singleton and its lower value is integral. It shall not read a lower payload after a false singleton result. check_empty_arg(x) shall return the empty predicate when the metadata admits emptiness; otherwise the caller shall supply a nonempty argument and the helper shall return false. These adapters shall preserve their arguments and add no allocation, initialization or rounding prerequisites to the selected scalar/member query.
RATIONALE: Generic interval algorithms need borrowed views of actual intervals and singleton scalars without copying endpoints or reading inactive empty payloads.
INTERFACE: Names belong to Parma_Polyhedra_Library unless qualified otherwise. Template excerpts omit SFINAE return-type restrictions described in the text.
template <typename B, typename I> bool f_is_empty(const Interval<B,I>&); template <typename B, typename I> bool f_is_singleton(const Interval<B,I>&); template <typename B, typename I> int infinity_sign(const Interval<B,I>&); namespace Interval_NS { // Overloads for intervals and admitted singleton scalars: template <typename T> const auto& f_lower(const T&); template <typename T> const auto& f_upper(const T&); template <typename T> const auto& f_info(const T&); template <typename T> Scalar_As_Interval_Info_Open f_info(const T&, bool); } template <typename T> bool is_singleton_integer(const T&); template <typename T> bool check_empty_arg(const T&);
VERIFICATION_CRITERIA: Check reference identity, shared/independent metadata, both openness states, empty/singleton/nonsingleton intervals, integral/fractional scalars, NaN and admitted infinities. Exercise the nonempty-only metadata branch and short-circuiting over empty intervals.
SOURCE: src/Interval_inlines.hh; src/Interval_defs.hh; tests/scalaradaptersspec1.cc.
-
5. Borrowed or converted distance operands UID: PPL-SPEC-001643 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: maybe_assign(top,tmp,from,dir) shall select its behavior from the exact source and destination C++ types. If they are identical, it shall set top to the address of from, leave tmp unchanged and return V_EQ; it shall perform no numerical conversion or allocation. Otherwise it shall set top to the address of tmp, perform assign_r(tmp,from,dir) and return that operation's result. Its dispatch structs shall have the same behavior.
The operands shall remain live; temporary storage shall be initialized as required by the selected assignment. For differing types, the assignment's admitted values, rounding direction, aliasing, initialization, resource and exception conditions shall apply. If assignment throws, top shall already designate tmp and the assignment's destination guarantee shall apply. Borrowing shall not extend the source lifetime. A returned pointer shall not be used after its referent is destroyed or invalidated.
RATIONALE: Distance kernels can avoid a conversion and scratch write when the input already has the required exact type, while exposing conversion outcomes otherwise.
INTERFACE: Names belong to Parma_Polyhedra_Library unless qualified otherwise. Template excerpts omit SFINAE return-type restrictions described in the text.
template <typename To, typename From> Result maybe_assign(const To*&, To&, const From&, Rounding_Dir); template <typename To, typename From> struct maybe_assign_struct; // Static member of each general/same-type dispatch struct: static Result function(const To*&, To&, const From&, Rounding_Dir);
VERIFICATION_CRITERIA: Check address identity, untouched same-type scratch, value/result equivalence to explicit assignment for exact and directed inexact conversions, and selected assignment exceptions with top already changed. Exercise both the public helper and dispatch specializations.
SOURCE: src/distances_inlines.hh; tests/scalaradaptersspec1.cc.
-
Incoming link from: 6. Checked named nonnegative square root1
1. Directed and delegated square root of a finite native value UID: PPL-SPEC-000501 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The source and destination shall be configured native F or Checked_Number<F, Check_Overflow_Policy<F>> types with the same floating-point format, as in 🔗 4. Rounding, result classes and state for finite native binary arithmetic. The source shall be finite and nonnegative, including either signed zero, with represented value a. sqrt_assign_r shall compute the nonnegative real √(a).
ROUND_DOWN shall assign its greatest representable lower bound and ROUND_UP its least representable upper bound. ROUND_IGNORE shall use the current hardware direction, including nearest-even midpoint selection. Exactly representable roots shall preserve their values. A zero root shall retain the source zero's sign. Every computed result for this source domain shall be finite and have class VC_NORMAL, without V_UNREPRESENTABLE.
Weak, strict, delegated and no-rounding-needed result relations shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic, with exactness relative to √(a). A no-rounding-needed request shall require that root to be exactly representable. Directed, strict and no-rounding-needed requests shall require upward hardware rounding; unflagged delegated requests shall admit every current hardware direction. Calls shall preserve the current direction. Source/destination aliases, source preservation, object validity, synchronization, native backend setup, initialization independence and floating-point exception conditions shall follow 🔗 4. Rounding, result classes and state for finite native binary arithmetic.
RATIONALE: A square-root bound can be checked exactly by squaring its nonnegative endpoints. Finite nonnegative native inputs need no artificial coefficient- range restriction.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted same-format To and From types:
Result sqrt_assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Compare squared result and adjacent-native-value bounds with exact rational source values for zero, perfect squares, nonsquares, precision boundaries, subnormals, normal minima and finite maxima. Check all admitted raw/checked forms, directed/delegated/strict statuses, nearest selection, valid exactness requests, signed zeros, self/raw aliases and hardware-state preservation.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/squarerootspec1.cc.
-
Incoming links from: 2. Euclidean distance of bounded-difference closed-bound tables 2. Euclidean distance between Box endpoint tuples 6. Checked named nonnegative square root 18. Euclidean distance between bound-entry arrays 2. Euclidean distance between generator points 3. Euclidean distance of octagonal closed-bound tables 7. Euclidean distance of physical octagonal entry arrays 3. Selection and ownership of irrational rational precision8
2. Finite rational square root at the selected irrational precision UID: PPL-SPEC-000502 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The source and destination shall be mpq_class. The source shall be finite, canonical and nonnegative, with value a; canonical form shall follow 🔗 1. Exact rational assignment from rational and integral sources. Let p be the current precision in 🔗 3. Selection and ownership of irrational rational precision and S = 2p. Zero shall produce canonical zero and V_EQ for every supported direction/strict flag.
For a > 1, the downward result shall be ⌊S√(a)⌋ ⁄ S and the upward result ⌈S√(a)⌉ ⁄ S. For 0 < a ≤ 1, the downward result shall be S ⁄ ⌈S ⁄ √(a)⌉ and the upward result S ⁄ ⌊S ⁄ √(a)⌋. Results shall be canonical, nonnegative rationals with the lesser of numerator and denominator no greater than S. Without the strict flag the downward relation shall be V_GE and the upward relation V_LE. With the flag, exactness shall give V_EQ, a strict lower bound V_GT and a strict upper bound V_LT.
ROUND_IGNORE shall produce one of these two precision-grid bounds and return a relation containing the actual comparison of √(a) with the result. With a strict flag it shall determine V_EQ, V_GT or V_LT. ROUND_NOT_NEEDED shall require an exact root on the selected grid: S√(a) shall be an integer for a > 1, or S ⁄ √(a) an integer for 0 < a ≤ 1. It shall return that exact root, with V_EQ in an assertion-enabled build and permitted lazy V_LGE in a build defining NDEBUG; a strict exactness request shall return V_EQ.
Source and destination may be the same object. Source numerator/denominator references borrowed by the caller shall not be used across a modifying call. A source with distinct storage shall remain unchanged. The destination shall be live and assignable. Resource availability shall limit unbounded intermediates. No FPU direction, library/thread initialization object or coefficient-constant stage shall be required. Hardware direction shall remain unchanged. The precision shall remain stable throughout the call. Non-thread-safe configurations shall serialize shared precision and lazy temporary-pool use; thread-safe configurations shall use the calling thread's precision and pools. Object access shall be synchronized against concurrent mutation. The _r interface shall return its result without policy-handler dispatch.
RATIONALE: A selected rational precision defines a finite grid for square-root approximation while preserving sound directed bounds both above and below one. The result relation must describe the final root approximation rather than an intermediate integer division.
INTERFACE: Public header: <ppl.hh>; effective template instantiation:
Result sqrt_assign_r(mpq_class& to, const mpq_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use independent integer/rational squared comparisons and grid-index searches for zero, one, perfect/nonperfect rational squares and values above/below one, at precision0 and increasing finite precisions. Check canonical bounds, numerator/denominator limits, weak/strict/delegated relations, valid selected- grid exactness requests, source/self-alias preservation, precision stability and FPU independence in every coefficient profile.
SOURCE: src/checked_mpq_inlines.hh; src/checked_mpz_inlines.hh; src/checked.cc; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/squarerootspec1.cc.
-
Incoming links from: 2. Euclidean distance of bounded-difference closed-bound tables 2. Euclidean distance between Box endpoint tuples 6. Checked named nonnegative square root 18. Euclidean distance between bound-entry arrays 2. Euclidean distance between generator points 3. Euclidean distance of octagonal closed-bound tables 7. Euclidean distance of physical octagonal entry arrays 2. Finite rational square root at the selected irrational precision8
3. Selection and ownership of irrational rational precision UID: PPL-SPEC-000503 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: irrational_precision() shall return the current unsigned precision parameter. set_irrational_precision(p) shall accept every value from zero through INT_MAX and make subsequent reads return p. For a value greater than INT_MAX, it shall throw std::invalid_argument and leave the previous precision unchanged.
The selected value shall be the square-root precision in 🔗 2. Finite rational square root at the selected irrational precision. In a thread-safe configuration, each thread shall own its parameter independently; in a non-thread-safe configuration, callers shall serialize reads, writes and calculations using the shared parameter. Clients shall keep the parameter stable throughout each dependent numerical call. Initialized thread lifetimes shall establish the default described in 🔗 3. Thread initialization, default state and finalization. These accessors themselves shall require no library or thread initialization owner, coefficient-constant stage or FPU setup, and shall preserve hardware rounding direction.
RATIONALE: Precision is an explicit numerical parameter, with a defined range and ownership rule. Changing it must neither silently truncate the requested value nor disturb unrelated native rounding state.
INTERFACE: Public header: <ppl.hh>; PPL interfaces:
unsigned irrational_precision(); void set_irrational_precision(unsigned p);
VERIFICATION_CRITERIA: Check zero, ordinary values and INT_MAX, then reject larger unsigned values with exactly std::invalid_argument and unchanged stored precision. Restore the caller parameter after testing. In thread-safe configurations, verify isolated values in independent workers without explicit initialization owners; serialize all non-thread-safe tests. Preserve hardware direction and exercise no-FPU configurations.
SOURCE: src/checked_mpq_inlines.hh; src/checked.cc; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/squarerootspec1.cc.
-
3. Directed unbounded integer division and explicit delegated convention UID: PPL-SPEC-000513 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For the mpz_class objects and prerequisites in 🔗 1. Exact named arithmetic on unbounded integer storage, the divisor b shall be nonzero. Let q = a ⁄ b denote the exact rational quotient. div_assign_r with ROUND_DOWN shall assign ⌊q⌋ and return V_GE; with ROUND_UP it shall assign ⌈q⌉ and return V_LE. With ROUND_STRICT_RELATION, a directed request shall instead return V_EQ when q is integral, otherwise V_GT for downward rounding or V_LT for upward rounding.
ROUND_IGNORE shall use the ceiling convention and return a relation containing q ≤ to. A strict delegated request shall identify equality or strict inequality. ROUND_NOT_NEEDED shall require b to divide a exactly, assign the exact integer quotient and return a relation admitting equality; with ROUND_STRICT_RELATION it shall return V_EQ. The exactness decision shall use entry operands even when the output aliases either source. Other alias, preservation, resource, initialization and hardware independence conditions shall follow 🔗 1. Exact named arithmetic on unbounded integer storage.
RATIONALE: Integer storage requires an explicit floor, ceiling or delegated convention for a nonintegral quotient. Entry-operand exactness prevents an aliased write from changing the reported relation.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result div_assign_r(mpz_class& to, const mpz_class& x, const mpz_class& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use an independent integer long-division oracle for all source signs, exact and inexact division, zero dividends and large magnitudes. Check all valid admitted requests, relation strictness, source/destination aliases, shared operands, reconstruction inequalities and source preservation.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerarithmeticspec1.cc.
-
5. Unbounded integer arithmetic with powers of two UID: PPL-SPEC-000515 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For mpz_class objects and prerequisites in 🔗 1. Exact named arithmetic on unbounded integer storage, let e be an unsigned exponent and m = 2e. Resources shall suffice for the requested power and output; there shall be no native shift-width precondition on e. add_2exp_assign_r, sub_2exp_assign_r and mul_2exp_assign_r shall assign exactly a + m, a − m and am, respectively, and return V_EQ for every valid rounding request.
div_2exp_assign_r shall round a ⁄ m downward or upward with the same directed value and relation rules as 🔗 3. Directed unbounded integer division and explicit delegated convention. ROUND_IGNORE shall truncate toward zero and return a relation admitting the actual comparison; a strict delegated request shall distinguish equality and strict inequality. ROUND_NOT_NEEDED shall require m to divide a, assign the exact quotient and return a relation admitting equality; a strict exactness request shall return V_EQ. This delegated truncation convention shall apply to power-of-two division independently of the ceiling convention for general div_assign_r.
Source/destination aliases, source preservation and other prerequisites shall follow 🔗 1. Exact named arithmetic on unbounded integer storage. Shared scratch-integer pools used to form an additive power shall be serialized in a build without thread-safe support; thread-safe configurations shall use calling-thread pools. No FPU setup, initialized library owner or coefficient-constant stage shall be needed.
RATIONALE: Unbounded integer shifts must not inherit a native coefficient width limit, while division still needs an explicit rounding convention and exactness precondition.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result add_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result sub_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result mul_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result div_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir);
VERIFICATION_CRITERIA: Exercise exponent zero, native-width boundaries and exponents above every bounded coefficient width with literal or independently derived integer powers. Check all signs, exact/inexact division, strict and delegated outcomes, aliases, source preservation and exactness requests when divisible.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerarithmeticspec1.cc.
-
2. Directed canonical rational conversion to an unbounded integer UID: PPL-SPEC-000262 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a finite canonical mpq_class source with value a, assign_r into mpz_class with base direction ROUND_DOWN shall assign ⌊a⌋; base ROUND_UP shall assign ⌈a⌉. Rational canonical form shall follow 🔗 1. Exact rational assignment from rational and integral sources. The destination shall not designate the source rational's numerator or denominator object or overlap their storage. There shall be no fixed-width integer range bound.
Without ROUND_STRICT_RELATION, the downward request shall return V_GE and the upward request V_LE. These shall permit equality and shall not promise that an integral source has been classified as exact. With that flag, an integral source shall return V_EQ; a nonintegral source shall return V_GT downward and V_LT upward, with the relation orientation in 🔗 1. Numerical result classes and relation meanings.
No particular current hardware rounding direction shall be required and the current direction shall remain unchanged. Object validity, synchronization, source preservation, initialization independence and resource conditions shall follow 🔗 1. Exact native integral and unbounded integer assignment to mpz storage. This conversion shall require no shared temporary pool.
RATIONALE: A rational quotient can be rounded exactly using integer numerator and denominator operations. A weak result relation is a deliberate classification unless strict relation determination was requested.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source types:
Result assign_r(mpz_class& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use literal signed quotients and independent unbounded quotient/remainder calculations for exact integers, proper fractions, halves and large numerator/denominator values. Require the documented weak classifications without strict flags and definite classifications with them. Repeat under all hardware modes, preserving canonical source components.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerconversionspec1.cc; tests/numericpublic1.cc.
-
4. Directed finite native floating-point conversion to mpz storage UID: PPL-SPEC-000264 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: The source shall be a finite float, double or long double whose corresponding PPL_SUPPORTED_FLOAT, PPL_SUPPORTED_DOUBLE or PPL_SUPPORTED_LONG_DOUBLE is nonzero. Its meaning shall be the exact represented binary value a. ROUND_DOWN shall assign ⌊a⌋ to mpz_class and ROUND_UP shall assign ⌈a⌉, with no fixed-width integer range restriction.
For float and double, a nonintegral source shall require the hardware rounding direction to be upward. An integral source shall return V_EQ; a nonintegral downward result shall return V_GT and an upward result V_LT, with or without the strict-relation flag. Exact integral inputs shall not require a particular current hardware direction.
For long double, no particular hardware direction shall be required. Without the strict flag the downward request shall return V_GE and the upward request V_LE. With the flag it shall return V_EQ for an integral source, V_GT for an inexact downward result and V_LT for an inexact upward result. This classification shall follow the exact rational route in 🔗 2. Directed canonical rational conversion to an unbounded integer, including when the native long double format has the same precision as double.
Object validity, source preservation, resource limits and initialization independence shall follow 🔗 1. Exact native integral and unbounded integer assignment to mpz storage. Current hardware rounding direction shall be preserved. The long double route shall use a lazily owned rational temporary; in a non-thread-safe configuration, concurrent calls sharing that temporary machinery shall be serialized, even on distinct argument objects. In a thread-safe configuration its pool shall belong to the calling thread. Unavailable native source types shall not be instantiated.
RATIONALE: All finite floating-point values have exact dyadic rational meanings and therefore admit unbounded integer bounds. Different native source routes may expose different relation precision without changing the integer result.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source types:
Result assign_r(mpz_class& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: For each configured source format, derive exact significand/power-of-two oracles for positive and negative fractions, subnormals, precision boundaries and finite maxima. Check strict and nonstrict result classifications separately for float/double versus long double. Use upward hardware direction for nonintegral float/double and every hardware direction for the rational long-double route; preserve source values and direction state.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerconversionspec1.cc.
-
Incoming link from: 7. Raw scalar placement construction and exact assignment1
6. Finite native floating-point placement construction of an unbounded integer UID: PPL-SPEC-001196 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: The source type F shall be float or double with its corresponding PPL_SUPPORTED_FLOAT or PPL_SUPPORTED_DOUBLE nonzero. The source shall be a live finite value with exact represented binary value a. The selected source and destination policies shall admit these finite values and provide the capabilities used by the native-to-mpz_class conversion. No policy rounding default or result handler shall be required.
The destination reference shall designate writable storage of at least sizeof(mpz_class) bytes, correctly aligned for mpz_class, with no live mpz_class occupying it. The storage shall be available for placement construction without ending an object lifetime that the caller must preserve. The source shall not overlap that storage. Before placement construction begins the destination glvalue shall be used only in ways permitted for storage outside an object's lifetime; it shall not be read as a live mpz_class. On normal return exactly one live mpz_class shall occupy the storage. Its caller shall arrange exactly one destruction of that object before releasing or reusing the storage.
ROUND_DOWN shall construct ⌊a⌋ and ROUND_UP shall construct ⌈a⌉. These requests shall return V_EQ for an integral source, otherwise V_GT downward or V_LT upward, with or without ROUND_STRICT_RELATION. ROUND_IGNORE shall construct trunc(a) and return V_LGE without the strict flag. With that flag it shall return V_EQ for an integral source, V_GT for a positive nonintegral source, and V_LT for a negative nonintegral source.
A raw kernel ROUND_NOT_NEEDED request shall require an integral source, construct its exact integer value and return V_LGE without the strict flag or V_EQ with it. A caller-translated ROUND_CHECK exactness request shall retain that integral-source precondition and return V_EQ. The public numerical construct adapter shall perform the direction and exactness-check translation in 🔗 7. Internal no-rounding-needed request and result checking before invoking this kernel. The kernel shall return Result without policy-handler dispatch.
A directed request on a nonintegral source shall require upward hardware rounding. Integral sources and delegated truncation shall require no particular current direction. Every call shall preserve the current hardware rounding direction. Floating-point exceptions shall be nontrapping; accrued exception flags shall be unspecified. Available GMP resources shall be required, without a fixed-width integer limit. No library/thread initialization owner, coefficient-constant stage or shared temporary pool shall be required. Callers shall synchronize storage use against concurrent access. Resource failure shall not be a successful result; no universal object-lifetime or storage-rollback guarantee shall be imposed after an abnormal exit.
RATIONALE: Placement construction begins an integer object's lifetime, whereas assignment requires an already live object. The numerical result and its relation must remain consistent with the requested rounding and exactness conventions without introducing a policy-handler decision.
INTERFACE: Internal header: src/checked_mpz_inlines.hh; namespace Parma_Polyhedra_Library::Checked; admitted F and policy types above:
template <typename To_Policy, typename From_Policy, typename F> Result construct_mpz_float(mpz_class& to, const F& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use correctly aligned raw storage and the admitted public numerical construct route or the internal kernel. After a successful construction, obtain the live object using the applicable C++ lifetime rules, compare it with an independent exact rational oracle, and destroy it exactly once. Check both source formats, both signs, zeros, nonintegral dyadic values, subnormals, finite maxima and exact integral values. Exercise all admitted directions and strict flags, including raw kernel exactness and the public adapter's debug/release translation. Check unchanged source values and hardware direction, definite strict relations, lazy unflagged relations, zero handler calls, and independence from the configured coefficient width. Do not inspect an unconstructed object or infer a general failure rollback.
SOURCE: src/checked_mpz_inlines.hh; src/checked_ext_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; tests/unboundedintegerconversionspec1.cc.
-
Incoming link from: 6. Checked named nonnegative square root1
3. Directed unbounded integer square roots UID: PPL-SPEC-000519 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For a live nonnegative mpz_class source with value a, let r = √(a) denote the exact nonnegative real root. sqrt_assign_r with ROUND_DOWN shall assign ⌊r⌋ and with ROUND_UP shall assign ⌈r⌉. A perfect-square source shall return V_EQ for either direction. Otherwise, downward rounding shall return V_GT and upward rounding shall return V_LT. Adding ROUND_STRICT_RELATION shall retain these definite classifications.
ROUND_IGNORE shall select the floor and return a relation admitting r ≥ to. A strict delegated request shall distinguish V_EQ from V_GT. ROUND_NOT_NEEDED shall require a to be a perfect square, assign the exact root and return a relation admitting equality; a strict exactness request shall return V_EQ. The result shall never depend on irrational_precision.
The destination may alias the source, using its entry value. A distinct source shall remain unchanged. Resource, range, synchronization and initialization/hardware independence conditions shall follow 🔗 1. Exact named arithmetic on unbounded integer storage. Shared scratch-integer pools used for directed root remainders shall be serialized in a build without thread-safe support; thread-safe configurations shall use calling-thread pools.
RATIONALE: An unbounded integer root is an adjacent integer bound on the real square root and is independent of the rational square-root precision grid.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result sqrt_assign_r(mpz_class& to, const mpz_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use an independent integer bisection oracle and squared inequalities. Check zero, one, perfect squares and their neighbors, very large inputs, both directed relations, delegated and admitted exactness requests, aliases, unchanged sources and all available hardware modes.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerfunctionspec1.cc.
-
1. Numerical and geometric foundations UID: PPL-HLR-000001 STATUS: APPROVED COMPONENT: LIBRARY_WIDE APPLICABILITY: ALL VERIFICATION_METHODS: Test, Analysis, Review RELATIONS (Child): - PPL-LLR-000446 Reloadable textual representations (Refined by)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Refined by)
- PPL-LLR-000012 Affine meaning of linear expressions (Refined by)
- PPL-LLR-000013 Meaning of linear constraints (Refined by)
- PPL-LLR-000014 Meaning of linear congruences (Refined by)
- PPL-LLR-000015 Distinct meanings of geometric generators (Refined by)
- PPL-LLR-000001 Exact integral coefficient calculations (Refined by)
- PPL-LLR-000002 Detection of checked coefficient overflow (Refined by)
- PPL-LLR-000003 Conservative directed numerical bounds (Refined by)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Refined by)
- PPL-LLR-000414 Integer quotient and remainder semantics (Refined by)
- PPL-LLR-000415 Exact rational arithmetic (Refined by)
STATEMENT: PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.
RATIONALE: Domains and solvers need a common interpretation of coefficients, coordinates, expressions, constraints and generators.
VERIFICATION_CRITERIA: Review the common mathematical definitions and their consistency across domains; exercise representative descriptor construction, arithmetic and dimension changes under each supported numerical configuration.
BIBLIOGRAPHY: BagnaraHZ08SCP | Whole work (background on the library's numerical abstractions and design).
SOURCE: doc/definitions.dox: Basic_Geometric_Descriptors, Syntactic_Geometric_Descriptors; src/Coefficient_defs.hh; src/Linear_Expression_defs.hh.
- PPL-SPEC-001197 Complete checked-wrapper placement construction without a handler (Specified by)
- PPL-SPEC-000918 Exact coefficient ratio followed by upward scalar conversion (Specified by)
- PPL-SPEC-000324 Typed special-value assignment to native floating-point storage (Specified by)
- PPL-SPEC-000201 Supported exact integer and rational conversion to native floating storage (Specified by)
- PPL-SPEC-000202 Directed conversion to adjacent finite normal floating-point bounds (Specified by)
- PPL-SPEC-000203 Directed conversion in the subnormal and underflow range (Specified by)
- PPL-SPEC-000204 Delegated and exactness requests for floating-point conversion (Specified by)
- PPL-SPEC-000205 Floating conversion overflow thresholds and computed-value classes (Specified by)
- PPL-SPEC-000241 Supported finite native floating-to-integral scalar conversion (Specified by)
- PPL-SPEC-000242 Directed finite floating-to-integral rounding within range (Specified by)
- PPL-SPEC-000243 Delegated floating-to-integral truncation and exactness requests (Specified by)
- PPL-SPEC-000244 Floating-to-integral range detection and reusable destinations (Specified by)
- PPL-SPEC-000161 Exact conversion between native and checked integral scalars (Specified by)
- PPL-SPEC-000162 Exact conversion from an unbounded integer to integral storage (Specified by)
- PPL-SPEC-000163 Directed rational-to-integral conversion within range (Specified by)
- PPL-SPEC-000164 Truncated rational-to-integral conversion and lazy relation requests (Specified by)
- PPL-SPEC-000165 Integral scalar conversion range outcomes (Specified by)
- PPL-SPEC-000166 Rational conversion at and beyond integral endpoints (Specified by)
- PPL-SPEC-000341 Directed native integral conversion to native floating-point storage (Specified by)
- PPL-SPEC-000342 Delegated and exactness native integral conversion to native floating point (Specified by)
- PPL-SPEC-000343 Exact native floating-point assignment to the same or a wider native format (Specified by)
- PPL-SPEC-000344 Directed narrowing between finite native floating-point formats (Specified by)
- PPL-SPEC-000345 Delegated and exactness native floating-point narrowing (Specified by)
- PPL-SPEC-000346 Range limits in conversion of finite native scalars to floating point (Specified by)
- PPL-SPEC-000124 Rounding-direction intent, composition and inspection (Specified by)
- PPL-SPEC-000527 Numeric text input into integral destinations (Specified by)
- PPL-SPEC-000528 Numeric text input into supported native floating destinations (Specified by)
- PPL-SPEC-000091 Exact rational assignment from rational and integral sources (Specified by)
- PPL-SPEC-000092 Exact rational assignment of finite native floating-point values (Specified by)
- PPL-SPEC-000098 Rational canonical-form inspection and coefficient component extraction (Specified by)
- PPL-SPEC-000919 Exact scalar numerator and denominator extraction (Specified by)
- PPL-SPEC-001641 Weakly relational extended-number policies (Specified by)
- PPL-SPEC-001643 Borrowed or converted distance operands (Specified by)
- PPL-SPEC-000261 Exact native integral and unbounded integer assignment to mpz storage (Specified by)
- PPL-SPEC-000262 Directed canonical rational conversion to an unbounded integer (Specified by)
- PPL-SPEC-000263 Delegated and exactness rational conversion to an unbounded integer (Specified by)
- PPL-SPEC-000264 Directed finite native floating-point conversion to mpz storage (Specified by)
- PPL-SPEC-000265 Delegated finite floating-point conversion and exactness into mpz storage (Specified by)
- PPL-SPEC-001196 Finite native floating-point placement construction of an unbounded integer (Specified by)
When a supported numerical conversion distinguishes exact and inexact success, an exact-success outcome shall preserve the source value and an inexact-success outcome shall satisfy the conversion's stated approximation direction.
Conversion precision is part of the mathematical result and cannot be inferred merely from completion of the conversion.
Verification covers numerical conversion values and precision outcomes. Related obligations: 🔗 6. Exact rational arithmetic, 🔗 1. Meaning of successful exact and approximate results.
Check conversions among supported integer, rational and floating-point profiles using values that are exactly representable, values between representable numbers and values at range limits. Independently verify both the converted value and the precision classification.
src/Result_defs.hh: result classifications. src/checked_defs.hh: conversion contracts. src/checked_inlines.hh: conversion operations.
-
6. Complete checked-wrapper placement construction without a handler UID: PPL-SPEC-001197 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For an admitted call to the result-returning free construct function with To = Checked_Number<T, Policy>, the destination shall denote suitably aligned storage sufficient for that complete wrapper, with no live complete wrapper occupying it. T shall be an admitted native integer, configured native floating format, mpz_class or mpq_class. A numerical source shall be live and initialized; a typed special marker shall have its existing marker meaning. Source storage shall not overlap the unconstructed destination. The selected source/destination policies, scalar conversion and rounding request shall satisfy their existing numerical, representation, resource, initialization, FPU and synchronization prerequisites.
On normal return, a complete destination wrapper and its owned scalar shall have begun their lifetimes. The wrapper shall admit destruction and subsequent supported assignment. The represented result and returned Result shall have the selected checked conversion or typed-special assignment meaning. A failure or unrepresentable result shall not promise a numerical payload that its result and policy do not otherwise define. The source shall be preserved. The free function shall apply its existing exactness-request translation and result check once, without invoking a policy result handler or requiring a constructor rounding default. Both deduced calls and calls that explicitly specify To and From shall have this meaning.
If conversion throws after an owned class scalar has been initialized, ordinary constructor unwinding shall destroy that scalar. No complete destination wrapper is returned from the failed construction. This rule shall not imply an allocation rollback guarantee for the containing row or a live wrapper that the caller must destroy after a failed constructor. Raw native/GMP construction routes and ordinary public wrapper constructors shall retain their existing contracts; in particular, this no-handler function shall not replace the result handling of an ordinary converting constructor.
RATIONALE: A raw scalar subobject construction does not itself start the enclosing non-implicit-lifetime checked wrapper. Constructing the complete wrapper centrally permits all free construction callers, including upward DB-row conversion, to use the intended wrapper type. A private no-handler entry keeps result-returning construction distinct from an ordinary converting constructor and gives initialized class members language-provided cleanup.
INTERFACE: Public header: <ppl.hh>; free functions in PPL, with the admitted destination restriction above. Existing enable conditions and overload selection remain.
template <typename To, typename From> Result construct(To& destination, const From& source, Rounding_Dir dir);
Internal private tagged construction and its checked-destination access helper implement the complete-object lifetime. They are not additional public constructors or new conversion-policy defaults.
VERIFICATION_CRITERIA: 1. Exercise numerical and typed-special free construction in aligned raw wrapper storage, both with deduction and explicit two-template arguments, using policies without rounding defaults or an available result handler. Check the returned relation/class, source preservation, supported replacement and destruction. Include native, MPZ and canonical MPQ scalar families. 2. Inspect the complete wrapper placement-new and the private constructor's live member access, one request translation and one result check. Verify that no destination member function is called before complete wrapper construction and that initialized class scalar cleanup is supplied on constructor failure. 3. Check upward row conversion with fresh coherent normal and fallback storage profiles, preserving numerical values and sources without an extra conversion handler. Check raw-native and raw-GMP construction results and their independent replacement and destruction behavior under their existing contracts.
SOURCE: src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/DB_Row_templates.hh; tests/checkedscalarsspec1.cc; tests/dbrowownedhistories1.cc.
-
1. Exact coefficient ratio followed by upward scalar conversion UID: PPL-SPEC-000918 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For finite configured-coefficient entry values a and nonzero b, div_round_up(to, x, y) shall form the exact rational ratio a ⁄ b and convert that ratio to the selected scalar destination using ROUND_UP. Neither coefficient shall first be rounded to the destination storage, and an integral intermediate quotient shall not replace the ratio. The ratio's numerator and denominator shall not be constrained by the range of the configured coefficient type.
An admitted destination shall be a native scalar, mpz_class, mpq_class or Checked_Number specialization for which the finite rational assignment is well-formed under its policy and configured scalar availability. For a native-integer destination, or checked native-integer storage, whose upward integer is within its finite policy range, the result shall be ⌈a ⁄ b⌉. An unbounded integer destination shall receive that exact integer; a rational destination shall receive the exact canonical ratio. Supported native floating storage shall receive the upward bound required by 🔗 1. Supported exact integer and rational conversion to native floating storage, 🔗 2. Directed conversion to adjacent finite normal floating-point bounds, 🔗 3. Directed conversion in the subnormal and underflow range, 🔗 4. Delegated and exactness requests for floating-point conversion and 🔗 5. Floating conversion overflow thresholds and computed-value classes. Checked floating storage shall retain the policy admission in 🔗 4. Ordered comparison of finite native floating-point values.
Destination range outcomes and unsupported-payload meaning shall retain 🔗 5. Integral scalar conversion range outcomes and 🔗 6. Rational conversion at and beyond integral endpoints for bounded integral storage. An unchecked bounded policy shall require its admitted representability conditions. The helper shall return void and shall not expose intermediate or final Result values. It shall not invoke a policy handler, consult a constructor/operator/function rounding default, or turn a returned unsupported-result classification into a numeric exception. An unsupported destination outcome shall not promise a represented answer; callers requiring one shall satisfy the selected conversion's range conditions. Allocation and other exceptions escaping the underlying operations shall propagate with their own destination guarantees.
The two source arguments may identify the same coefficient. When its types permit, the destination may be either or both source objects; every source shall be read using its entry value before the destination is written. Distinct sources shall remain unchanged. Objects shall remain live and access shall be synchronized against overlapping modifications. In a non-thread-safe build, calls shall not overlap other PPL operations using shared temporary storage; a thread-safe build shall provide independent per-thread temporaries. Available resources shall limit temporary rational storage. No library/thread initialization or coefficient-constant stage shall be required. Floating conversion shall add only its delegated configured-format prerequisites, require no particular current hardware rounding direction and preserve that direction.
RATIONALE: Geometric domains need an upward scalar bound for an exact coefficient ratio, including when the numerator and denominator cannot first be represented in the destination storage.
INTERFACE: Internal header: math_utilities_defs.hh; function template in Parma_Polyhedra_Library:
template <Native_Or_Checked_Number T> void div_round_up(T& to, Coefficient_traits::const_reference x, Coefficient_traits::const_reference y);
VERIFICATION_CRITERIA: Use an independent integer quotient/remainder oracle for every sign combination, zero numerators, exact and fractional ratios, coefficient endpoints and large GMP ratios. Check raw and checked scalar destinations, finite policy ranges, represented range fallbacks, unsupported-result reuse, canonical rationals and adjacent floating upper bounds including subnormal and overflow endpoints. Check source preservation, both destination aliases, identical sources, all-same calls, exact void return type and policies without handlers or rounding defaults. Run actual configured coefficient profiles, supported floating formats and hardware rounding modes; compile and run the admitted non-floating scope with floating support disabled.
SOURCE: src/math_utilities_defs.hh; src/math_utilities_inlines.hh; tests/coefficientquotientspec1.cc.
-
Incoming links from: 6. Remainder with a policy-admitted infinite divisor 1. Conversion of policy-admitted scalar special values 2. Unary and binary-scale transformations of scalar special values 3. Extended scalar binary arithmetic and enabled fault diagnosis 4. Nonfinite remainder operands and enabled modulus faults 5. Extended accumulated products and enabled fault diagnosis 6. Square-root special values and enabled negative-input diagnosis 1. Same-type checked copying of admitted special values 1. Same-type checked copying of admitted special values 1. Checked special-marker construction and policy assignment 1. Checked special-marker construction and policy assignment 1. Typed special construction in native scalar storage 1. Typed special construction in native scalar storage 2. Typed special-marker assignment to GMP integer and rational storage14
4. Typed special-value assignment to native floating-point storage UID: PPL-SPEC-000324 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: 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.
RATIONALE: Typed markers let clients assign special values without depending on a native bit pattern or policy-specific sentinel representation.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted T and the three marker types Special:
Result assign_r(T& to, const Special& marker, Rounding_Dir dir);
VERIFICATION_CRITERIA: Assign each marker to raw and admitted checked destinations for every valid direction/strict flag and hardware mode. Independently classify the stored values and signs with native facilities, require exact Result codes and representability, preserve marker and hardware direction, and replace previously finite, infinite and NaN destinations. Ensure result-returning NaN assignment does not dispatch a throwing extended-number policy.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingclassificationspec1.cc; tests/numericpublic1.cc.
-
Incoming links from: 1. Exact coefficient ratio followed by upward scalar conversion 4. Rounding, result classes and state for finite native binary arithmetic 1. Native floating-point NaN and infinity predicates 2. Directed conversion to adjacent finite normal floating-point bounds 2. Directed conversion to adjacent finite normal floating-point bounds 3. Directed conversion in the subnormal and underflow range 4. Delegated and exactness requests for floating-point conversion 5. Floating conversion overflow thresholds and computed-value classes 5. Floating conversion overflow thresholds and computed-value classes 1. Directed native integral conversion to native floating-point storage 4. Numeric text input into supported native floating destinations11
1. Supported exact integer and rational conversion to native floating storage UID: PPL-SPEC-000201 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For each of float, double and long double whose corresponding PPL_SUPPORTED_FLOAT, PPL_SUPPORTED_DOUBLE or PPL_SUPPORTED_LONG_DOUBLE is nonzero, assign_r shall admit finite mpz_class and canonical finite mpq_class sources. The configured native binary format shall determine precision and finite range; it shall not inherit a bounded global-coefficient limit. Rational canonical form shall follow 🔗 1. Exact rational assignment from rational and integral sources.
When the source value is exactly representable as a finite destination value, the conversion shall assign that value and return V_EQ. This shall hold for all four base directions in 🔗 4. Rounding-direction intent, composition and inspection, with or without ROUND_STRICT_RELATION. Rational or integer zero shall produce a native zero; no distinct rational negative-zero value shall be implied.
The native destination adapter shall use Check_Overflow_Policy<T>. The _r conversion shall return its Result without invoking a policy handler or automatically throwing a numeric overflow exception. Computed infinities shall be representable in these supported native formats, and the outcomes in 🔗 5. Floating conversion overflow thresholds and computed-value classes shall not carry V_UNREPRESENTABLE.
The destination shall be a live assignable native object and the source shall remain unchanged. Callers shall prevent concurrent access to either object while another operation modifies it. No library initialization object, thread initialization or coefficient-constant stage shall be required. Configured native-format availability shall remain a prerequisite; a configuration disabling those supported types shall not promise these instantiations. For an available instantiation, conversion shall require no particular current FPU rounding direction and shall preserve that direction. Available resources shall limit temporary unbounded-integer computations.
RATIONALE: An exact integer or rational conversion can construct a native binary value directly. Its correctness and relation need not depend on a host floating-point rounding mode or the global coefficient width.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for a configured supported native floating-point type T:
Result assign_r(T& to, const mpz_class& from, Rounding_Dir dir); Result assign_r(T& to, const mpq_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check zero, both signs, exact significand powers of two, maximum finite values, minimum normal values and subnormal values for every supported destination type. Compare exact integer-significand/power-of-two values independently of decimal conversion, require V_EQ for all valid directions and strict flags, preserve sources and check every supported hardware rounding mode. Compile a configuration with FPU control disabled without instantiating unavailable floating-point conversions.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingconversionspec1.cc; tests/numericpublic1.cc.
-
2. Directed conversion to adjacent finite normal floating-point bounds UID: PPL-SPEC-000202 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For source value a within the destination finite range, with |a| at least the smallest positive normal value and not exactly representable, base direction ROUND_DOWN shall assign the greatest representable destination value less than a; base direction ROUND_UP shall assign the least representable value greater than a. The destination types, sources and object prerequisites shall follow 🔗 1. Supported exact integer and rational conversion to native floating storage.
The downward call shall return V_GT and the upward call shall return V_LT. These shall be definite exact-to-computed relations as defined by 🔗 1. Numerical result classes and relation meanings, whether or not the request carries ROUND_STRICT_RELATION. Both bounds shall be finite and adjacent in the native value set. A source halfway between adjacent values shall follow the specified bound direction; no nearest-even tie rule shall replace it. Exact representable values shall instead follow 🔗 1. Supported exact integer and rational conversion to native floating storage.
RATIONALE: A directed conversion selects an adjacent representable bound. Halfway inputs distinguish that obligation from nearest rounding, and an unbounded source can expose lost low significand bits precisely.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for a configured supported native floating-point type T:
Result assign_r(T& to, const mpz_class& from, Rounding_Dir dir); Result assign_r(T& to, const mpq_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Construct exact rational quarter, half and three-quarter points between independently established adjacent native values, including either sign, binade boundaries and the largest finite pair. Check the two exact endpoint values and strict Result codes. Include integer halfway values just beyond the exact-integer precision threshold through both mpz and mpq source paths, without overflowing native oracle arithmetic.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingconversionspec1.cc; tests/numericpublic1.cc.
-
3. Directed conversion in the subnormal and underflow range UID: PPL-SPEC-000203 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: Let δ be the smallest positive representable native subnormal value and let N be the smallest positive normal value. For a finite rational source with 0 < |a| < N, ROUND_DOWN shall assign the greatest native value not exceeding a, and ROUND_UP the least native value not less than a. Zero and every supported subnormal value shall be included when selecting these bounds. Source, destination and lifetime prerequisites shall follow 🔗 1. Supported exact integer and rational conversion to native floating storage.
An exactly representable subnormal shall return V_EQ. Otherwise the downward result shall return V_GT and the upward result V_LT, with or without a strict-relation flag. In particular, 0 < a < δ shall yield zero downward and δ upward; − δ < a < 0 shall yield − δ downward and zero upward. No sign-bit value shall be prescribed for a computed zero. The results shall be normal-class numerical bounds with no unrepresentable-storage flag.
RATIONALE: Underflow must retain an outward bound even when a nonzero rational is smaller than every native nonzero value. Treating these cases as unconditional zero would lose the requested direction.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for a configured supported native floating-point type T:
Result assign_r(T& to, const mpz_class& from, Rounding_Dir dir); Result assign_r(T& to, const mpq_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check exact minimum and larger subnormals, fractions below the minimum, their signs, subnormal halfway points, and the pair straddling the largest subnormal and smallest normal value. Establish rational values with integer powers of two and independently compare the returned zero/subnormal endpoints, exact or strict relations and storage flags under all hardware rounding states.
SOURCE: tests/floatrepresentationsspec1.cc; src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingconversionspec1.cc.
-
4. Delegated and exactness requests for floating-point conversion UID: PPL-SPEC-000204 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For a finite source within the destination finite range, ROUND_IGNORE shall select the representable value obtained by rounding toward zero. An exact representable source shall return V_EQ. A positive inexact source shall return V_GT and a negative inexact source shall return V_LT. Adding ROUND_STRICT_RELATION shall preserve these definite relations. Destination types, source validity and object prerequisites shall follow 🔗 1. Supported exact integer and rational conversion to native floating storage.
ROUND_NOT_NEEDED shall require an exact source value representable as a finite destination value. With or without the strict flag, it shall assign that value and return V_EQ in assertion and nonassertion builds. Delegated requests outside the finite range shall follow 🔗 5. Floating conversion overflow thresholds and computed-value classes. These software conversions shall not infer their result from the hardware inexact flag or modify the current hardware rounding direction.
RATIONALE: Delegation does not imply nearest rounding. For these integer-based conversions the toward-zero construction and exact remainder determine a definite relation without hardware inexact-state ownership.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for a configured supported native floating-point type T:
Result assign_r(T& to, const mpz_class& from, Rounding_Dir dir); Result assign_r(T& to, const mpq_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check positive and negative nonrepresentable rational values under ignore requests with and without strict relation, including subnormal and precision-boundary cases. Require toward-zero values and definite classifications. Exercise exact normal, subnormal, zero and endpoint values under both forms of no-rounding-needed request in both build modes.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingconversionspec1.cc.
-
Incoming links from: 1. Exact coefficient ratio followed by upward scalar conversion 1. Supported exact integer and rational conversion to native floating storage 4. Delegated and exactness requests for floating-point conversion 1. Truncated native floating quotient before storage rounding 1. Truncated native floating quotient before storage rounding 4. Numeric text input into supported native floating destinations6
5. Floating conversion overflow thresholds and computed-value classes UID: PPL-SPEC-000205 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a supported destination type in 🔗 1. Supported exact integer and rational conversion to native floating storage, let p be its binary precision, emax its max_exponent, H = 2emax and M = (2p − 1)2emax − p, its largest finite value. Each source shall be a finite integer or canonical rational and satisfy the object prerequisites of 🔗 1. Supported exact integer and rational conversion to native floating storage. An optional strict-relation flag shall not change the following outcomes.
For M < a < H, ROUND_DOWN and ROUND_IGNORE shall assign M and return V_GT. ROUND_UP shall assign positive infinity and return V_LT_PLUS_INFINITY. For − H < a < − M, ROUND_UP and ROUND_IGNORE shall assign − M and return V_LT; ROUND_DOWN shall assign negative infinity and return V_GT_MINUS_INFINITY. Computed infinity shall carry its corresponding infinity class, including when obtained by stepping past a finite endpoint.
For a ≥ H, ROUND_DOWN shall assign M and return V_GT_SUP; ROUND_UP and ROUND_IGNORE shall assign positive infinity and return V_LT_PLUS_INFINITY. For a ≤ − H, ROUND_UP shall assign − M and return V_LT_INF; ROUND_DOWN and ROUND_IGNORE shall assign negative infinity and return V_GT_MINUS_INFINITY.
These numeric range outcomes shall be returned directly, without policy exception dispatch, and shall leave the destination usable. The native infinities shall be representable, so V_UNREPRESENTABLE shall be absent. ROUND_NOT_NEEDED shall exclude these out-of-range sources.
RATIONALE: A finite inward rounding immediately beyond the endpoint differs from clamping a value whose unrestricted-exponent rounded result is itself outside the finite format. In every case the reported class must agree with a computed infinite bound.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for a configured supported native floating-point type T:
Result assign_r(T& to, const mpz_class& from, Rounding_Dir dir); Result assign_r(T& to, const mpq_class& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check integer and rational sources just beyond both finite endpoints, H and its negative, and larger magnitude values. Require inward endpoint values, outward infinity signs and exact Result classes/flags for every admitted direction. Check both signs and source paths around the finite-to-infinity successor/predecessor transition, then reassign destinations and preserve sources.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingconversionspec1.cc.
-
Incoming links from: 2. Directed finite floating-to-integral rounding within range 2. Directed finite floating-to-integral rounding within range 2. Directed finite floating-to-integral rounding within range 3. Delegated floating-to-integral truncation and exactness requests 3. Delegated floating-to-integral truncation and exactness requests 4. Floating-to-integral range detection and reusable destinations6
1. Supported finite native floating-to-integral scalar conversion UID: PPL-SPEC-000241 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The source shall be a finite float, double or long double whose corresponding configured PPL_SUPPORTED_FLOAT, PPL_SUPPORTED_DOUBLE or PPL_SUPPORTED_LONG_DOUBLE is nonzero. Its mathematical value shall be the exact represented binary value, without a decimal approximation. A destination shall be one of the eleven native integral types or Checked_Number<T, Check_Overflow_Policy<T>> types in 🔗 1. Exact conversion between native and checked integral scalars. Native destinations shall use that overflow policy through their _r adapter and shall reserve no payload for infinity or NaN.
For an integral source value representable in the destination, assign_r shall assign that exact integer. Either sign of native floating-point zero shall produce integer zero. Directed ROUND_DOWN and ROUND_UP requests, with or without a strict flag, shall return V_EQ for these exact inputs. Delegated and no-rounding-needed classifications shall follow 🔗 3. Delegated floating-to-integral truncation and exactness requests.
The destination shall be a live assignable object and a distinct source shall remain unchanged. Callers shall prevent concurrent access to an object while another operation modifies it. No library initialization object, thread initialization or coefficient-constant stage shall be required. A directed request on a nonintegral source shall require the hardware rounding mode to be upward, as established by the rounding protocol in 🔗 4. Rounding-state exchange during an initialized thread lifetime; exact integral inputs shall not require a particular mode. Every call shall preserve the current hardware rounding direction. The _r interface shall return Result without policy-handler dispatch or automatic numeric overflow exceptions. Unavailable source types shall not be instantiated.
RATIONALE: An integral scalar conversion depends on the represented source value and destination policy. Exact inputs do not require a floating approximation, while the nonintegral directed kernel has an explicit hardware-rounding prerequisite.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source and destination types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: For every configured native floating source and all native/checked destination types, check zero, both signs and representable integral endpoints using an independent significand/power-of-two oracle. Require directed V_EQ and exact values under every supported hardware mode, preserve sources and direction state, and compile unavailable configurations without source-type instantiations.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingtointegerspec1.cc; tests/numericpublic1.cc.
-
2. Directed finite floating-to-integral rounding within range UID: PPL-SPEC-000242 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a finite source value a and admitted source/destination types from 🔗 1. Supported finite native floating-to-integral scalar conversion, ROUND_DOWN shall assign ⌊a⌋ and ROUND_UP shall assign ⌈a⌉ whenever that requested integer is representable. A nonintegral source shall require the upward hardware rounding mode in 🔗 1. Supported finite native floating-to-integral scalar conversion. An optional ROUND_STRICT_RELATION flag shall not change the mathematical result.
A nonintegral downward result shall return V_GT and a nonintegral upward result shall return V_LT, with exact-to-computed orientation from 🔗 1. Numerical result classes and relation meanings. An integral source shall return V_EQ. A source just outside the destination's integer endpoints whose requested rounded integer is an endpoint shall produce that ordinary definite relation, without an integer-range-overflow annotation. This shall include upward rounding of a negative proper fraction to unsigned zero.
Out-of-range rounded integers shall follow 🔗 4. Floating-to-integral range detection and reusable destinations. Source, object-synchronization, lifetime and hardware-mode preservation shall follow 🔗 1. Supported finite native floating-to-integral scalar conversion.
RATIONALE: A conversion selects the requested integer bound. The original floating value may lie beyond an integer endpoint even though the requested bound is a valid endpoint, so source range and rounded-result range must be distinguished.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source and destination types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use exact dyadic proper and improper fractions of both signs and verify floor/ceiling with an independent integer quotient/remainder oracle. Cover strict and nonstrict requests, interior integers and adjacent fractions at every destination endpoint, including inward rounding from outside and unsigned zero. Preserve upward hardware mode and distinct sources.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingtointegerspec1.cc.
-
3. Delegated floating-to-integral truncation and exactness requests UID: PPL-SPEC-000243 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For admitted source and destination types in 🔗 1. Supported finite native floating-to-integral scalar conversion, ROUND_IGNORE shall assign trunc(a) toward zero when that integer is representable. With no strict flag, the successful conversion shall return V_LGE for integral and nonintegral source values. No particular current hardware direction shall be required for this truncating request.
ROUND_NOT_NEEDED shall require an exact integral source value representable in the destination. For that valid request, the integer value shall be preserved under any current hardware rounding direction. Without a strict flag, its result shall be V_EQ in an assertion-enabled build and may be lazy V_LGE in a build defining NDEBUG, following the internal request translation in 🔗 7. Internal no-rounding-needed request and result checking.
With ROUND_STRICT_RELATION, a delegated request shall determine the definite relation: V_GT for a positive inexact source truncated toward zero, V_LT for a negative inexact source, and V_EQ for an integral source. A strict no-rounding-needed request shall retain its exact integral precondition and return V_EQ. Range failures under delegated requests shall follow 🔗 4. Floating-to-integral range detection and reusable destinations. Object validity, source preservation and hardware-direction preservation shall follow 🔗 1. Supported finite native floating-to-integral scalar conversion.
RATIONALE: Truncation and relation precision are separate requests. A lazily classified exact payload must not be confused with a determined equality relation, and strict requests must resolve that distinction.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source and destination types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check signed dyadic truncation under ignore requests with documented V_LGE results, exact no-rounding-needed inputs in both build modes and all hardware states, and definite relations for each strict form. Include zero, proper fractions, endpoint-adjacent inputs, both destination forms and preservation of sources and hardware direction.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingtointegerspec1.cc; tests/numericpublic1.cc.
-
4. Floating-to-integral range detection and reusable destinations UID: PPL-SPEC-000244 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For the admitted types and valid hardware prerequisites in 🔗 1. Supported finite native floating-to-integral scalar conversion, let q be the requested floor, ceiling or truncated integer defined by 🔗 2. Directed finite floating-to-integral rounding within range and 🔗 3. Delegated floating-to-integral truncation and exactness requests. If q lies below the destination minimum, ROUND_UP shall store that minimum and return V_LT_INF; ROUND_DOWN or ROUND_IGNORE shall return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE. If q lies above the maximum, ROUND_DOWN shall store that maximum and return V_GT_SUP; ROUND_UP or ROUND_IGNORE shall return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE. An optional strict flag shall not change these range outcomes.
A requested integer within range shall follow the ordinary classifications of 🔗 2. Directed finite floating-to-integral rounding within range and 🔗 3. Delegated floating-to-integral truncation and exactness requests. Checking range shall not itself require an undefined native floating-to-integer cast, including when a floating source format cannot represent the destination's maximum integer exactly. A failed range request shall not report a wrapped integer as successful. An unrepresentable result shall leave the destination assignable and destructible without a payload-value guarantee. ROUND_NOT_NEEDED shall exclude out-of-range inputs. These result codes shall be returned directly without automatic policy exception dispatch.
RATIONALE: Safe conversion must guard the actual requested integer range before any narrowing native cast. A finite source can exceed a destination bound even when the source format rounds that bound to a different floating value.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source and destination types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use unbounded dyadic oracles for every signed/unsigned endpoint and neighboring representable floating values. Include the largest source-representable integer inside each destination, the first outside it, large finite source maxima and negative values targeting unsigned storage. Require exact range codes, inward endpoints, outward flags, reusable outputs and no undefined-behavior sanitizer findings under valid hardware modes.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingtointegerspec1.cc.
-
Incoming links from: 1. Supported finite native floating-to-integral scalar conversion 2. Exact conversion from an unbounded integer to integral storage 3. Directed rational-to-integral conversion within range 4. Truncated rational-to-integral conversion and lazy relation requests 5. Integral scalar conversion range outcomes 6. Rational conversion at and beyond integral endpoints 1. Directed native integral conversion to native floating-point storage 1. Exact native integral and unbounded integer assignment to mpz storage8
1. Exact conversion between native and checked integral scalars UID: PPL-SPEC-000161 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The native integral types covered here shall be char , signed char , unsigned char , short , unsigned short , int , unsigned int , long , unsigned long , long long and unsigned long long . An integral source or destination may instead be Checked_Number<T, Check_Overflow_Policy<T>> for one of those native types T . For these integral types, the policy shall reserve no integer payload for infinity or NaN. The scalar wrapper range shall be the full native range, independent of the selected global coefficient profile.
For a source value representable in the destination, assign_r shall assign that exact integer and return V_EQ . This shall hold for the four base directions in 🔗 4. Rounding-direction intent, composition and inspection , with or without the strict flag. The source may be the destination when its type admits both roles; the entry value shall be preserved. Native destinations shall use that same overflow policy through their _r adapter. Out-of-range outcomes shall follow 🔗 5. Integral scalar conversion range outcomes .
The returned Result shall report the conversion directly; the _r operation shall not invoke the destination policy's handle_result . The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage.
RATIONALE: Finite integral embedding and narrowing have the same exact meaning when the value fits. A checked scalar policy belongs to the instantiated scalar, rather than to whichever global coefficient alias was configured.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above.
VERIFICATION_CRITERIA: Exercise every listed native source/destination type pair and native/wrapper source/destination combination. Check exact status and values for common signed values, zero and all endpoints that fit the destination, with all admitted directions and exact self-aliases. Preserve distinct sources and compare endpoints with unbounded integer values.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc ; tests/numericpublic1.cc. tests/smallconstantassign1.cc.
-
2. Exact conversion from an unbounded integer to integral storage UID: PPL-SPEC-000162 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For a finite mpz_class source whose integer value is representable in a native or checked integral destination admitted by 🔗 1. Exact conversion between native and checked integral scalars , assign_r shall assign that exact integer and return V_EQ . It shall admit both signed and unsigned destination ranges, including the least signed integer and the maximum unsigned integer.
The four base directions in 🔗 4. Rounding-direction intent, composition and inspection , with or without the strict flag, shall not change the exact value or classification. Out-of-range outcomes shall follow 🔗 5. Integral scalar conversion range outcomes . The _r conversion shall return its result directly without policy-handler dispatch. The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage.
RATIONALE: An unbounded integer can represent a destination endpoint exactly, including a signed minimum whose positive magnitude does not fit in that signed type.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above; From shall be mpz_class.
VERIFICATION_CRITERIA: Use an unbounded integer oracle for each signed and unsigned endpoint, zero, both signs and representable interior values. Check native and checked destinations with every direction and strict flag, exact status and source preservation. Include native types as wide as long long and unsigned long long.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc ; tests/numericpublic1.cc.
-
3. Directed rational-to-integral conversion within range UID: PPL-SPEC-000163 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a finite canonical rational source with value a , assign_r with base direction ROUND_DOWN shall assign ⌊a⌋ ; with base direction ROUND_UP it shall assign ⌈a⌉ . The destination shall be one of the native or checked integral types in 🔗 1. Exact conversion between native and checked integral scalars . Canonical rational representation shall follow 🔗 1. Exact rational assignment from rational and integral sources .
For a directed integer result representable in the destination, an integral source value shall produce V_EQ . A nonintegral value rounded downward shall produce V_GT and a nonintegral value rounded upward shall produce V_LT , with exact-to-computed relation orientation as in 🔗 1. Numerical result classes and relation meanings . Adding ROUND_STRICT_RELATION shall preserve these values and definite classifications.
Out-of-range outcomes for either destination form shall follow 🔗 6. Rational conversion at and beyond integral endpoints . This conversion shall return Result without policy-handler dispatch. The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage. Rational-source conversions shall use thread-local temporary storage in a thread-safe build; callers shall serialize those conversions across threads in a non-thread-safe build.
RATIONALE: Rational conversion selects a neighboring integer according to the requested direction. Its exact relation can be established from integer quotient and remainder without floating-point approximation.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above; From shall be mpq_class.
VERIFICATION_CRITERIA: Use literal fractions and an independent integer quotient/remainder oracle for both signs, exact integers, halves and proper fractions. Check floor/ceiling values and definite result relations in every native and checked destination, including rounded values equal to either endpoint and source values just outside an endpoint that round inward.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc .
-
4. Truncated rational-to-integral conversion and lazy relation requests UID: PPL-SPEC-000164 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For a finite canonical rational source with value a , base direction ROUND_IGNORE shall assign trunc(a) , toward zero, when that integer is representable in a destination from 🔗 1. Exact conversion between native and checked integral scalars . With no strict-relation flag, successful conversion shall return V_LGE ; it shall not claim exactness from an unchanged integer payload alone.
ROUND_NOT_NEEDED shall require a to be an integer representable in the destination. For that valid use, the assigned integer shall be exact. With no strict-relation flag, the returned classification may be lazy V_LGE in a build defining NDEBUG ; the assertion-enabled request translation in 🔗 7. Internal no-rounding-needed request and result checking shall instead establish V_EQ .
When ROUND_STRICT_RELATION is supplied with either base direction, the conversion shall report the definite relation requested by 🔗 4. Rounding-direction intent, composition and inspection . A nonintegral positive value truncated toward zero shall produce V_GT ; a nonintegral negative value shall produce V_LT ; an integral value shall produce V_EQ . The exactness and representability preconditions of ROUND_NOT_NEEDED shall still apply when it carries that flag.
Truncation range failures under ROUND_IGNORE shall follow 🔗 6. Rational conversion at and beyond integral endpoints . The returned result shall not cause automatic policy-handler dispatch. The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage. Rational-source conversions shall use thread-local temporary storage in a thread-safe build; callers shall serialize those conversions across threads in a non-thread-safe build.
RATIONALE: A lazy relation and an exact assigned payload are distinct observations. A strict relation request must determine which side of the truncated integer contains the rational value.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above; From shall be mpq_class.
VERIFICATION_CRITERIA: Check signed truncation answers and lazy V_LGE results for unflagged ignore requests. Check exact representable no-rounding-needed values in assertion and nonassertion builds, with their documented classifications. Independently check definite relations for strict requests, including negative proper fractions, positive proper fractions and exact integers. Preserve source components.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc .
-
5. Integral scalar conversion range outcomes UID: PPL-SPEC-000165 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a native integral, checked integral or mpz_class source, a native integral or Checked_Number<T, Check_Overflow_Policy<T>> destination shall detect a source integer outside its full native T range. The native source and destination types shall be those in 🔗 1. Exact conversion between native and checked integral scalars . This shall be a Result -returning conversion; an arithmetic range failure shall not invoke handle_result or throw an overflow exception automatically.
If the source is below the destination minimum, ROUND_UP shall store that minimum and return V_LT_INF . ROUND_DOWN or ROUND_IGNORE shall return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE . If the source is above the destination maximum, ROUND_DOWN shall store that maximum and return V_GT_SUP . ROUND_UP or ROUND_IGNORE shall return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE . An optional strict-relation flag shall not change these range outcomes.
An unrepresentable result shall not promise a meaningful destination payload; the destination shall remain assignable and destructible. ROUND_NOT_NEEDED shall require an exact representable result and shall therefore exclude these out-of-range requests, with or without a strict flag. These guarantees shall not extend to a Checked_Number destination whose policy disables overflow checking. The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage.
RATIONALE: A checked conversion returning Result must expose both the safe inward endpoint and the inability to represent the outward bound. It must allow its caller to choose subsequent policy handling.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above; To shall be an admitted native or checked destination type.
VERIFICATION_CRITERIA: Generate integers immediately outside every checked signed/unsigned range using an unbounded oracle. For native and checked integral sources, test each type pair whenever the source can represent the out-of-range value; also use mpz sources for every endpoint. Verify exact result codes, inward stored endpoints, unrepresentability flags, lack of automatic exception dispatch and reusable outputs.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc .
-
6. Rational conversion at and beyond integral endpoints UID: PPL-SPEC-000166 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a finite canonical rational source and a native or checked integral destination from 🔗 1. Exact conversion between native and checked integral scalars , assign_r shall distinguish a representable directed or truncated integer from range failure without policy-handler dispatch. Canonical representation shall follow 🔗 1. Exact rational assignment from rational and integral sources .
If truncating the rational toward zero already lies below or above the destination range, the conversion shall return the corresponding range outcome specified in 🔗 5. Integral scalar conversion range outcomes for the requested base direction. If that truncation lies within range but subsequent upward rounding would increase the maximum, it shall return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE . If subsequent downward rounding would decrease the minimum, it shall return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE . These shall not be reported as successful wrapped integers.
Representable rounded values shall follow 🔗 3. Directed rational-to-integral conversion within range or 🔗 4. Truncated rational-to-integral conversion and lazy relation requests , including a rational just beyond an endpoint whose requested integer rounds inward to that endpoint. An unrepresentable outcome shall preserve destination assignability and destructibility without a payload value promise. ROUND_NOT_NEEDED shall admit only exact representable integer results. A Checked_Number destination whose policy disables overflow checking shall remain outside this range-detection guarantee. The destination shall be live and assignable. A distinct source shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit temporary integer storage. Rational-source conversions shall use thread-local temporary storage in a thread-safe build; callers shall serialize those conversions across threads in a non-thread-safe build.
RATIONALE: Fractional endpoint crossings can fail during the directed increment or decrement even when the truncated quotient fits. They differ from a quotient already outside the destination range.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
The admitted source and destination types shall be as stated above; From shall be mpq_class and To an admitted native or checked destination type.
VERIFICATION_CRITERIA: Use exact thirds and halves immediately inside and outside every signed and unsigned endpoint, plus integral and fractional values more than one unit beyond it. Compare quotient/remainder-derived range cases and exact returned flags, both directed signs and strict requests; check valid unflagged lazy truncation separately. Require inward endpoint values and reusable outputs while preserving source components.
SOURCE: src/checked_int_inlines.hh ; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh ; tests/integerconversionspec1.cc .
-
Incoming links from: 4. Rounding, result classes and state for finite native binary arithmetic 2. Delegated and exactness native integral conversion to native floating point 2. Delegated and exactness native integral conversion to native floating point 2. Delegated and exactness native integral conversion to native floating point 2. Delegated and exactness native integral conversion to native floating point 3. Exact native floating-point assignment to the same or a wider native format 4. Directed narrowing between finite native floating-point formats 6. Range limits in conversion of finite native scalars to floating point 2. Mixed finite floating and exact scalar ordering9
1. Directed native integral conversion to native floating-point storage UID: PPL-SPEC-000341 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: The destination shall be a configured supported native floating-point type F in 🔗 1. Supported exact integer and rational conversion to native floating storage, or Checked_Number<F, Check_Overflow_Policy<F>>. The source shall be one of the eleven native integral types in 🔗 1. Exact conversion between native and checked integral scalars, or its Checked_Number<I, Check_Overflow_Policy<I>> wrapper, with integer value a. It shall be independent of the configured Coefficient alias.
Within the destination finite range, ROUND_DOWN shall assign the greatest representable value no greater than a; ROUND_UP shall assign the least representable value no less than a. Exactly representable integers shall preserve their values. Source-range crossings shall follow 🔗 6. Range limits in conversion of finite native scalars to floating point. Zero shall produce positive zero.
Let p be std::numeric_limits<F>::digits and w the native source type's object width CHAR_BIT * sizeof(I). When p > w, conversion shall return V_EQ under every directed/strict request and shall require no particular hardware rounding direction. Otherwise, downward conversion shall return V_GE and upward conversion V_LE without the strict flag. With that flag and available definite native inexact information, an exact result shall return V_EQ and an inexact result V_GT downward or V_LT upward. If definite inexact information is unavailable, the corresponding weak relation shall be returned. These potentially inexact directed conversions shall require upward hardware rounding and shall preserve that direction.
The destination shall be live and assignable, and a distinct source shall remain unchanged. Callers shall synchronize access against concurrent object mutation. Floating-point exceptions shall be nontrapping; accrued flags shall be unspecified. Native conversions using FPU control or inexact queries shall require an available backend. On IA-32 backends using SSE, runtime SSE detection shall have completed before those facilities are used, through 🔗 1. Initialization owners and automatic C++ initialization and 🔗 3. Thread initialization, default state and finalization or fpu_initialize_control_functions(). C99-fenv and SPARC backends shall require no library or thread initialization object. No coefficient-constant stage or shared numerical temporary pool shall be required. The _r interface shall return the conversion result without policy-handler dispatch.
RATIONALE: Native integer embedding can remain exact or provide adjacent directed bounds without introducing an intermediate bounded coefficient. Result precision and native floating-point state prerequisites are part of that conversion interface.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted integral From and floating To types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Cross every configured destination format with all eleven native integral types and their checked wrappers. Check full endpoints, zero, signed values and precision-boundary integers against independent unbounded-integer/dyadic oracles. Require adjacent directed bounds, exact or weak/strict classifications as specified, positive zero, preserved sources and hardware direction; use every hardware mode for uniform exact embeddings.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/nativefloatingconversionspec1.cc. tests/smallconstantassign1.cc.
-
2. Delegated and exactness native integral conversion to native floating point UID: PPL-SPEC-000342 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the integral source/destination types in 🔗 1. Directed native integral conversion to native floating-point storage, ROUND_IGNORE shall use the current hardware rounding direction to convert a. Within finite range it shall use the nearest allowed destination value in that direction; nearest-even hardware mode shall resolve exact midpoints toward an even significand. Range behavior shall follow 🔗 6. Range limits in conversion of finite native scalars to floating point. ROUND_NOT_NEEDED shall require the source integer to be exactly representable as a finite destination value and shall assign that value.
When p > w as defined in 🔗 1. Directed native integral conversion to native floating-point storage, all these requests shall return V_EQ. Otherwise, an unflagged delegated request shall return V_LGE. A strict delegated request with definite native inexact information shall return V_EQ for an exact result and V_NE for an inexact result; if that information is unavailable it shall return V_LGE. An unflagged no-rounding-needed request shall return V_EQ in an assertion-enabled build and may return lazy V_LGE in a build defining NDEBUG. A strict no-rounding-needed request shall retain its exact-representability precondition and return V_EQ.
Unflagged delegated and no-rounding-needed requests shall require no particular current hardware direction and shall preserve it. A strict delegated request that uses inexact queries shall require upward hardware direction and preserve it. Source/destination validity, synchronization, backend setup, initialization independence, exception conditions and result-returning behavior shall follow 🔗 1. Directed native integral conversion to native floating-point storage.
RATIONALE: Delegation preserves the caller-selected native rounding behavior, while a no- rounding-needed request carries an exact-representability precondition. A strict inexact result can be known to differ without specifying which side was chosen by a delegated mode.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for the integral-source conversions in 🔗 1. Directed native integral conversion to native floating-point storage:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check delegated conversions under every hardware mode with independent exact integer and adjacent-native-value distance oracles, including nearest-even midpoints. Check exactness requests only for exactly representable finite inputs in both build modes. Test uniform exact source types separately from potentially inexact source types, strict exact/inexact statuses, unavailable- inexact-information fallbacks, source preservation and hardware direction.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/nativefloatingconversionspec1.cc. tests/smallconstantassign1.cc.
-
Incoming link from: 4. Directed narrowing between finite native floating-point formats1
3. Exact native floating-point assignment to the same or a wider native format UID: PPL-SPEC-000343 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: The source and destination shall be raw or Checked_Number<T, Check_Overflow_Policy<T>> instances of configured supported native floating-point types. The source shall be finite. When sizeof(From_native) <= sizeof(To_native) and the configured destination format contains every finite source value exactly, assign_r shall preserve the represented value and return V_EQ for every base direction, with or without ROUND_STRICT_RELATION. Either signed zero shall retain its sign. This shall include same-format assignments and native double/long double formats having equal precision and storage size.
Source and destination may be the same object or share storage through a checked object's raw-value reference when their native types agree. The conversion shall use the source entry value. A source with distinct storage shall remain unchanged, and later destination mutation shall not affect it. No particular hardware rounding direction, native inexact query, library or thread initialization object, coefficient-constant stage or shared numerical temporary pool shall be required. Calls shall preserve hardware direction. Destination validity, object synchronization, availability, exception conditions and result-returning behavior shall follow 🔗 1. Directed native integral conversion to native floating-point storage.
RATIONALE: An exact embedding between native formats is independent of a global coefficient width and does not require the FPU to establish an approximation direction.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted floating-point To and From types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Cross every configured source/destination format pair admitting the exact route, with raw and checked sources/destinations. Compare exact dyadic values and zero signs at subnormals, normal boundaries, precision limits and finite source maxima. Check all direction/strict requests, every hardware mode, self/raw-storage aliases and independent copies without initialization stages.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/nativefloatingconversionspec1.cc.
-
4. Directed narrowing between finite native floating-point formats UID: PPL-SPEC-000344 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For configured native source/destination formats and raw or checked types in 🔗 3. Exact native floating-point assignment to the same or a wider native format with sizeof(From_native) > sizeof(To_native), the source shall be finite with exact represented value a. When a lies within destination finite range, ROUND_DOWN shall assign the greatest representable value no greater than a; ROUND_UP shall assign the least representable value no less than a. This shall include transitions between normal, subnormal and signed-zero values. A zero result shall retain the source's sign. Source-range crossings shall follow 🔗 6. Range limits in conversion of finite native scalars to floating point.
Without ROUND_STRICT_RELATION, downward conversion shall return V_GE and upward conversion V_LE, even for an exactly representable source. With the flag and definite native inexact information, it shall return V_EQ for exactness, V_GT for an inexact downward result and V_LT for an inexact upward result. When definite inexact information is unavailable, it shall return the corresponding weak relation.
These directed conversions shall require upward hardware rounding and shall preserve that direction. The source shall remain unchanged and the destination shall be live and assignable. Object synchronization, backend setup, availability, initialization independence, exception conditions and result-returning behavior shall follow 🔗 1. Directed native integral conversion to native floating-point storage.
RATIONALE: Native narrowing must preserve the selected bound even across underflow into subnormal or zero values. A weak relation remains meaningful when a backend cannot resolve native inexactness.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted floating-point To and From types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: For every actual narrowing pair and raw/checked combination, use exact significand rational oracles at midpoint neighborhoods, precision limits, normal/subnormal transitions and tiny nonzero inputs. Check tight bounds, signed zeros, exact/weak/strict classifications, source preservation and unchanged upward hardware direction. Exercise definite and unavailable native inexact classifications.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/nativefloatingconversionspec1.cc.
-
5. Delegated and exactness native floating-point narrowing UID: PPL-SPEC-000345 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the narrowing source/destination types in 🔗 4. Directed narrowing between finite native floating-point formats, ROUND_IGNORE shall convert the source's finite represented value using the current hardware direction. The nearest-even mode shall resolve exact midpoints toward an even significand. A zero result shall retain the source's sign. Source-range crossings shall follow 🔗 6. Range limits in conversion of finite native scalars to floating point. ROUND_NOT_NEEDED shall require a source value exactly representable as a finite destination value and shall preserve that value and zero sign.
An unflagged delegated request shall return V_LGE. With the strict flag and definite native inexact information, it shall return V_EQ for an exact result and V_NE for an inexact result; unavailable inexact information shall give V_LGE. An unflagged no-rounding-needed request shall return V_EQ in an assertion-enabled build and may return lazy V_LGE in a build defining NDEBUG. A strict no-rounding-needed request shall retain its exact-representability precondition and return V_EQ.
Unflagged delegated and no-rounding-needed requests shall admit every current hardware direction and preserve it. A strict delegated request using native inexact queries shall require upward hardware direction and preserve it. Source/destination validity, source preservation, synchronization, backend setup, availability, initialization independence, exception conditions and result-returning behavior shall follow 🔗 4. Directed narrowing between finite native floating-point formats.
RATIONALE: Native delegation and an asserted exact conversion have different preconditions and classifications. Their value guarantees do not disappear when lazy status information is returned.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted floating-point To and From types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check delegated rounding in every hardware direction using exact dyadic distance and nearest-even midpoint oracles, for all actual narrowing pairs and raw/checked combinations. Check valid no-rounding-needed sources in both build modes, strict exact/inexact statuses, zero signs, source preservation and direction. Keep exactly representable and inexact source sets distinct.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/nativefloatingconversionspec1.cc.
-
Incoming links from: 4. Rounding, result classes and state for finite native binary arithmetic 1. Directed native integral conversion to native floating-point storage 2. Delegated and exactness native integral conversion to native floating point 4. Directed narrowing between finite native floating-point formats 5. Delegated and exactness native floating-point narrowing5
6. Range limits in conversion of finite native scalars to floating point UID: PPL-SPEC-000346 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For the native scalar conversions in 🔗 1. Directed native integral conversion to native floating-point storage and 🔗 4. Directed narrowing between finite native floating-point formats, let M be the destination's maximum finite value and let a be a finite source outside [ − M, M]. For a > M, downward conversion shall assign M and upward conversion positive infinity. For a < − M, upward conversion shall assign − M and downward conversion negative infinity.
Delegated conversion shall use the current hardware direction. Toward-zero mode shall choose the finite endpoint; directed modes shall choose the corresponding endpoint or infinity above. In nearest-even mode, let u = 2emax − p be the last finite binade's spacing, where std::numeric_limits<F>::max_exponent is emax and destination precision is p. A magnitude below M + u ⁄ 2 shall choose the finite endpoint; a magnitude at or above that threshold shall choose the corresponding infinity.
Every finite computed endpoint shall have class VC_NORMAL and shall use the weak/strict relation of its conversion request. Every computed positive infinity shall have class VC_PLUS_INFINITY and every computed negative infinity VC_MINUS_INFINITY, with the corresponding conversion relation. These native infinities shall be representable, without V_UNREPRESENTABLE. The conversion shall not promise an integer-overflow annotation for a finite directed endpoint. No-rounding-needed requests shall retain their finite exact-representability precondition and shall not admit these source values. Object, state, availability and backend prerequisites shall follow the applicable conversion above.
RATIONALE: A directed finite endpoint and an infinite bound can both be valid approximations. The result class must nevertheless describe the value actually stored, independently of how precisely its relation is reported.
INTERFACE: Public header: <ppl.hh>; effective template instantiation for admitted floating-point To and From types:
Result assign_r(To& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use both signs of source values immediately beyond the destination maximum, the nearest-overflow midpoint and much larger finite values for every narrowing format pair. Check directed and delegated values, exact class fields, weak/strict relations and representability; repeat for native integral sources whenever their available width reaches this range. Preserve sources and hardware direction, with no invalid native casts or no-rounding-needed requests.
SOURCE: src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/nativefloatingconversionspec1.cc.
-
Incoming links from: 4. Typed special-value assignment to native floating-point storage 1. Supported exact integer and rational conversion to native floating storage 1. Finite native floating-point floor, ceiling and truncation 1. Exact conversion between native and checked integral scalars 2. Exact conversion from an unbounded integer to integral storage 4. Truncated rational-to-integral conversion and lazy relation requests 1. Exact native integral and unbounded integer assignment to mpz storage7
4. Rounding-direction intent, composition and inspection UID: PPL-SPEC-000124 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: ROUND_DOWN and ROUND_UP shall request bounds toward negative and positive infinity, respectively. ROUND_IGNORE shall delegate rounding and permit lazily evaluated relation information; ROUND_NATIVE shall be its alias. ROUND_NOT_NEEDED shall require the caller to ensure that the requested operation's result is exact and representable in its destination. ROUND_STRICT_RELATION shall request determination of the exact ordering relation rather than a weaker relation containing it. ROUND_DIRECT and ROUND_INVERSE shall alias ROUND_UP and ROUND_DOWN, respectively.
A supported direction shall contain one of the four base directions with an optional strict-relation flag. Bitwise operator& and operator| shall intersect and unite direction bits. round_dir shall retain exactly the ROUND_DIR_MASK bits. Each named direction predicate shall return true exactly when that base direction is selected, independently of the strict flag. round_not_requested shall return true exactly for ROUND_IGNORE or ROUND_NOT_NEEDED. round_strict_relation shall return true exactly when the strict-relation bit is present. These operations shall preserve the arguments, require no initialized library state and leave the hardware rounding state unchanged.
For constant-evaluable inputs, these operations shall support constant evaluation under the same stated preconditions.
RATIONALE: Rounding requests are numerical preconditions and intent, rather than instructions to change hardware state at every inspection. The strict flag is independent of the requested bound direction.
INTERFACE: Public header: <ppl.hh>; PPL declarations:
enum Rounding_Dir { ROUND_DOWN = 0U, ROUND_UP = 1U, ROUND_IGNORE = 6U, ROUND_NATIVE = ROUND_IGNORE, ROUND_NOT_NEEDED = 7U, ROUND_DIRECT = ROUND_UP, ROUND_INVERSE = ROUND_DOWN, ROUND_DIR_MASK = 7U, ROUND_STRICT_RELATION = 8U, ROUND_CHECK = ROUND_DIRECT | ROUND_STRICT_RELATION }; constexpr Rounding_Dir operator&(Rounding_Dir x, Rounding_Dir y); constexpr Rounding_Dir operator|(Rounding_Dir x, Rounding_Dir y); constexpr Rounding_Dir round_dir(Rounding_Dir dir); constexpr bool round_down(Rounding_Dir dir); constexpr bool round_up(Rounding_Dir dir); constexpr bool round_ignore(Rounding_Dir dir); constexpr bool round_not_needed(Rounding_Dir dir); constexpr bool round_not_requested(Rounding_Dir dir); constexpr bool round_direct(Rounding_Dir dir); constexpr bool round_inverse(Rounding_Dir dir); constexpr bool round_strict_relation(Rounding_Dir dir);
VERIFICATION_CRITERIA: Exhaust all four supported base directions with and without the strict flag. Check every predicate against a literal truth table, bitwise composition and exact return types; test both short-circuit conditions of round_not_requested. Preserve the hardware state across pure enum operations. Check the constant-expression operations with translation-time assertions in addition to the runtime contract tests.
SOURCE: src/Rounding_Dir_defs.hh and src/Rounding_Dir_inlines.hh; tests/numericprotocols1.cc; tests/numericpublic1.cc.
-
3. Numeric text input into integral destinations UID: PPL-SPEC-000527 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
- PPL-LLR-000446 Reloadable textual representations (Specifies)
STATEMENT: For a successfully parsed finite token of exact value q in 🔗 1. Exact finite numeric token syntax, input into each native integer or Checked_Number<I, Check_Overflow_Policy<I>> type admitted in 🔗 3. Directed rational-to-integral conversion within range shall apply the canonical rational conversion rules in 🔗 3. Directed rational-to-integral conversion within range, 🔗 4. Truncated rational-to-integral conversion and lazy relation requests and 🔗 6. Rational conversion at and beyond integral endpoints, with the same destination value, range outcome, result relation and exactness precondition. Input into mpz_class shall use 🔗 2. Directed canonical rational conversion to an unbounded integer and 🔗 3. Delegated and exactness rational conversion to an unbounded integer. In particular, directed requests shall use floor/ceiling and delegated integer conversion shall truncate toward zero; ROUND_NOT_NEEDED shall require an integral finite token value representable in the selected destination.
Token precision shall not first be restricted to the configured coefficient range or to a native floating type. Named input shall return the numeric conversion result without automatically dispatching a policy error handler. The token shall remain consumed if subsequent numeric conversion reports an unrepresentable result. Stream behavior, source synchronization and resources shall follow 🔗 2. Canonical rational input and stream failure outcomes. Shared rational temporary pools shall be serialized in a build without thread-safe support; thread-safe builds shall use calling-thread pools. Destination and initialization prerequisites shall follow the corresponding conversion contracts, without requiring an FPU merely to parse or round a rational into integral storage.
RATIONALE: Exact token semantics avoid intermediate floating or configured-coefficient rounding. A proven range outcome can be determined before large powers are expanded.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library for the admitted numeric types:
Result input(To& to, std::istream& stream, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use exact token fractions around integer zero, signed/unsigned endpoints and large MPZ values. Check floor, ceiling, delegated truncation, weak/strict results, admitted exactness requests, out-of-range reports, consumed tokens and destination reuse for all native integer and checked forms in every coefficient configuration.
SOURCE: src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_inlines.hh; src/checked_int_inlines.hh; src/checked_mpz_inlines.hh; src/checked.cc; tests/numberinput1.cc; tests/numerictextspec1.cc.
-
4. Numeric text input into supported native floating destinations UID: PPL-SPEC-000528 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
- PPL-LLR-000446 Reloadable textual representations (Specifies)
STATEMENT: For a successfully parsed finite token of exact rational value q, input into raw or Checked_Number<F, Check_Overflow_Policy<F>> storage shall apply the value, direction, exactness and range rules in 🔗 1. Supported exact integer and rational conversion to native floating storage, 🔗 2. Directed conversion to adjacent finite normal floating-point bounds, 🔗 3. Directed conversion in the subnormal and underflow range, 🔗 4. Delegated and exactness requests for floating-point conversion and 🔗 5. Floating conversion overflow thresholds and computed-value classes for the corresponding configured supported native format. The returned relation shall compare q with the stored native value. Strict requests shall retain the precision of that rational conversion; native token parsing shall not round through a narrower intermediate format or the configured coefficient type.
A lexical negative-zero token shall parse as rational zero and therefore store positive native zero. Nonzero negative underflow shall retain the negative sign required by the rational conversion. Named input shall return its numeric outcome directly, without policy handler dispatch. Stream consumption/failure and temporary-pool prerequisites shall follow 🔗 3. Numeric text input into integral destinations. No library initialization owner, coefficient-constant stage or irrational-precision setting shall be needed, and hardware direction shall not change. Native format availability and any arithmetic conditions shall follow the cited rational conversion contracts.
RATIONALE: Using the exact token rational as the floating conversion source prevents double rounding and distinguishes mathematical zero from a nonzero value underflowing to signed zero.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library for the admitted numeric types:
Result input(To& to, std::istream& stream, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check exact dyadics, decimal fractions, half-ULP neighbors, subnormal endpoints and native finite-range limits with independent rational oracles. Cross all supported formats/raw-checked destinations, directions and strict statuses, verify lexical versus underflow zero signs, exactness cases and hardware preservation.
SOURCE: src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_inlines.hh; src/checked_float_inlines.hh; src/checked.cc; tests/numberinput1.cc; tests/numerictextspec1.cc.
-
Incoming links from: 1. Supported exact integer and rational conversion to native floating storage 3. Directed rational-to-integral conversion within range 6. Rational conversion at and beyond integral endpoints 2. Exact rational assignment of finite native floating-point values 3. Exact finite rational addition, subtraction, multiplication and division 4. Rational sign assignments and integral-valued rounding operations 5. Truncated rational quotient and signed rational remainder 6. Exact rational operations with powers of two 7. Exact rational product accumulation and subtraction 9. Finite rational sign, comparison and numeric classification 2. GMP integer and rational special-value classification 1. Exact scalar numerator and denominator extraction 2. Finite rational square root at the selected irrational precision 2. Directed canonical rational conversion to an unbounded integer14
1. Exact rational assignment from rational and integral sources UID: PPL-SPEC-000091 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: assign_r(to, from, dir) shall replace to by the exact value of a canonical rational source, mpz_class source or supported native integral source, and shall return V_EQ. Integral assignment shall produce canonical denominator one, including for zero, both signs and signed and unsigned native endpoints. Rational self-assignment shall preserve its value.
The native source types shall be char, signed char, unsigned char, short, unsigned short, int, unsigned int, long, unsigned long, long long and unsigned long long. Their full representable ranges shall be admitted. The directions ROUND_DOWN, ROUND_UP, ROUND_IGNORE and ROUND_NOT_NEEDED, with an optional ROUND_STRICT_RELATION flag, shall not change this exact value or result classification.
Rational sources shall be finite canonical mpq_class objects: the denominator shall be positive, and numerator and denominator shall be coprime; zero shall be represented as 0/1. The destination shall be a live rational object. Distinct sources shall remain unchanged. Callers shall synchronize access overlapping modification of an argument object. No library initialization object, thread initialization or coefficient-constant stage shall be required. Available resources shall limit computation; no fixed coefficient-width bound shall be imposed on rational arithmetic itself.
RATIONALE: Rational assignment must preserve every finite integral value independently of the configured bounded coefficient type. An exact classification applies to both copied fractions and integral embeddings.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for mpq_class:
Result assign_r(mpq_class& to, const mpq_class& from, Rounding_Dir dir); Result assign_r(mpq_class& to, const mpz_class& from, Rounding_Dir dir);
The same template shall admit each listed native integral source type in place of mpz_class.
VERIFICATION_CRITERIA: Check exact status, canonical numerator/denominator and source preservation for all native source types, endpoint values, a multi-limb integer, rational self-copy and distinct copies. Repeat supported directions with and without strict relation, and reassign after earlier destination contents.
SOURCE: src/checked_mpq_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/rationalnumerics1.cc; tests/numericpublic1.cc.
-
Incoming link from: 1. Exact scalar numerator and denominator extraction1
2. Exact rational assignment of finite native floating-point values UID: PPL-SPEC-000092 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For a finite source of type float, double or long double whose corresponding PPL_SUPPORTED_FLOAT, PPL_SUPPORTED_DOUBLE or PPL_SUPPORTED_LONG_DOUBLE macro is nonzero, assign_r(to, from, dir) shall assign its exact mathematical value as a canonical rational and return V_EQ. This shall include signed zero, subnormal values where supported, and the finite endpoints of the source format. Either sign of floating-point zero shall produce rational 0/1. The result shall preserve the represented binary floating-point value, without substituting a nearby decimal interpretation.
ROUND_DOWN, ROUND_UP, ROUND_IGNORE and ROUND_NOT_NEEDED, with an optional ROUND_STRICT_RELATION flag, shall not change the assigned value or status. The current floating-point rounding direction shall not change the exact rational value. Nonfinite inputs and numeric policies for encoded special rationals shall be outside this finite-value contract.
The destination shall be a live rational object. Synchronization and resource prerequisites shall follow 🔗 1. Exact rational assignment from rational and integral sources. The floating-point source shall remain unchanged.
RATIONALE: A finite binary floating-point value is an exact rational even when its short decimal spelling is not. Source-format range does not imply a bounded coefficient range restriction on the rational destination.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for mpq_class:
Result assign_r(mpq_class& to, const float& from, Rounding_Dir dir); Result assign_r(mpq_class& to, const double& from, Rounding_Dir dir); Result assign_r(mpq_class& to, const long double& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check literal dyadic answers, both zeros, nonintegral values, subnormals, finite maxima and mantissa-boundary values for every source type. Establish expected rationals from integer significands and powers of two, independently of decimal printing. Repeat directions and supported hardware rounding states, preserving the source.
SOURCE: src/checked_mpq_inlines.hh; src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/rationalnumerics1.cc.
-
Incoming link from: 1. Exact scalar numerator and denominator extraction1
8. Rational canonical-form inspection and coefficient component extraction UID: PPL-SPEC-000098 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: is_canonical(x) shall return true exactly when x has positive denominator and coprime numerator and denominator. It shall admit a live mpq_class object with unreduced components or nonpositive denominator for inspection, preserve those components and return false when they violate the canonical conditions. It shall not normalize the inspected source.
For a finite canonical rational source with mathematical value n ⁄ d, numer_denom(from, numer, denom) shall assign its canonical numerator n and positive denominator d to the two configured coefficient outputs. The outputs shall be distinct and distinct from the source. Successful bounded-profile extraction shall require both components to be representable in the configured coefficient range. Native callers shall satisfy that range condition. Checked component overflow shall report std::overflow_error and retain the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch; an earlier output assignment need not be rolled back.
No library initialization object, thread initialization or coefficient- constant stage shall be required. Callers shall synchronize overlapping modifications of argument objects and serialize these temporary-storage operations across threads in a non-thread-safe build. A thread-safe build shall provide independent temporary storage for each thread. Available resources shall limit temporary rational storage.
RATIONALE: Canonical-form inspection must be useful on unreduced data without mutating it. Component extraction crosses from unbounded rational storage to a possibly bounded coefficient profile and therefore has a separate range condition.
INTERFACE: Internal interface and effective template instantiation in math_utilities_defs.hh within PPL:
bool is_canonical(const mpq_class& x); void numer_denom(const mpq_class& from, Coefficient& numer, Coefficient& denom);
VERIFICATION_CRITERIA: Check reduced and unreduced positive denominators, both numerator signs, canonical and noncanonical zero, negative and zero denominators while preserving source components. Extract literal signed fractions, zero and unit-denominator values in every coefficient profile; use large components for mpz and checked overflow cases where supported.
SOURCE: src/math_utilities_defs.hh and src/math_utilities_inlines.hh; tests/rationalnumerics1.cc.
-
1. Exact scalar numerator and denominator extraction UID: PPL-SPEC-000919 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: For a finite native integer, mpz_class, supported native floating value, or admitted Checked_Number scalar, numer_denom(from, numer, denom) shall obtain the source's exact rational value n ⁄ d in canonical form and assign n to numer followed by positive d to denom. The components shall be coprime. An integral source shall give its exact integer and denominator one; either sign of native zero shall give zero and one. Native floating values shall be interpreted as their exact binary values. Raw mpq_class extraction shall remain governed by 🔗 8. Rational canonical-form inspection and coefficient component extraction; a checked rational source here shall have a finite canonical payload under 🔗 1. Exact rational assignment from rational and integral sources. Supported floating-source availability and conversion prerequisites shall follow 🔗 2. Exact rational assignment of finite native floating-point values.
The output coefficient objects shall be distinct. When types permit, one output may designate the complete integral source value, including the whole integral raw value owned by a checked source. Both outputs shall then use the source's entry value, copied before either assignment. Outputs shall not designate proper numerator/denominator subobjects of rational source storage. A source disjoint from the output objects shall remain unchanged, including its floating sign of zero and rational component representation.
Both components shall fit the configured coefficient range for an unchecked bounded coefficient profile. A checked bounded profile shall report unrepresentable components through the configured coefficient assignment policy and its std::overflow_error in 🔗 5. Checked coefficient overflow and result-policy dispatch. A failure assigning the denominator may follow a completed numerator assignment; there shall be no two-output rollback promise. Surviving outputs shall retain that assignment's valid-reuse and destruction guarantees. Unbounded coefficient storage shall impose no fixed component range. Allocation and other escaping exceptions shall retain the underlying operations' guarantees.
The helper shall return void. It shall not require rounding defaults or a handler from a checked source policy, or invoke that source policy's handler. Assignment to the configured coefficient outputs shall retain their own policy behavior. Objects and borrowed source values shall remain live; access shall be synchronized against overlapping modification. With a non-thread-safe build, callers shall serialize operations using shared PPL temporary storage; a thread-safe build shall provide independent per-thread temporaries. No library/thread initialization or coefficient- constant stage shall be required. Available resources shall limit temporary rational storage. The current hardware rounding direction shall be preserved.
RATIONALE: Constructing exact constraints from scalar values requires canonical integer components without first rounding the value to a configured coefficient.
INTERFACE: Internal header: math_utilities_defs.hh; function template in Parma_Polyhedra_Library, for the source families above:
template <Native_Or_Checked_Number T> void numer_denom(const T& from, Coefficient& numer, Coefficient& denom);
VERIFICATION_CRITERIA: Check literal integral/GMP components and independent binary-significand floating oracles, both signs and signed zeros, canonical rational wrappers, source-policy capability without defaults/handlers and exact void return. Exercise actual coefficient ranges, first- and second-output checked overflow, valid reuse, borrowed integral source aliases and independent outputs. Verify source representation and hardware-mode preservation; cover actual disabled floating support without instantiating unavailable source conversions.
SOURCE: src/math_utilities_defs.hh; src/math_utilities_inlines.hh; tests/scalarcomponentsspec1.cc.
-
3. Weakly relational extended-number policies UID: PPL-SPEC-001641 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: Both WRD_Extended_Number_Policy and Debug_WRD_Extended_Number_Policy shall enable overflow checks, NaN and infinity representations, and requested FPU inexact checks. The production policy shall disable checks for opposite-infinity addition, same-infinity subtraction, infinity-times-zero, division by zero, infinity division, infinite remainder, negative square root and extra FPU NaN-result detection. The debugging policy shall enable all those checks.
Neither policy shall define convertible or any of the five ROUND_DEFAULT_* members. Operations needing them shall require an explicitly suitable policy instead of silently selecting a default. handle_result(r) shall forward exactly results whose class is VC_NAN to throw_result_exception(r) and propagate the resulting exception. Every normal or infinity result shall be accepted without an exception, including normal-class results carrying overflow or unrepresentable flags. The policies shall require no library initialization or rounding-mode change. Arithmetic using these policies shall retain its own numerical prerequisites; disabled checks shall not authorize undefined mathematical operations.
RATIONALE: Weakly relational algorithms explicitly control rounding and use infinity bounds; policy capabilities and debugging diagnostics must not be mistaken for implicit defaults.
INTERFACE: Names belong to Parma_Polyhedra_Library unless qualified otherwise. Template excerpts omit SFINAE return-type restrictions described in the text.
struct WRD_Extended_Number_Policy; struct Debug_WRD_Extended_Number_Policy; // Member of each policy: static void handle_result(Result);
VERIFICATION_CRITERIA: Check every policy constant, absence of conversion/default-rounding members and every defined result category, including overflow/unrepresentable flags. Compare forwarded NaN exception types with throw_result_exception and require acceptance of normal/infinity categories.
SOURCE: src/WRD_coefficient_types_defs.hh; src/WRD_coefficient_types_inlines.hh; tests/scalaradaptersspec1.cc.
-
5. Borrowed or converted distance operands UID: PPL-SPEC-001643 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): STATEMENT: maybe_assign(top,tmp,from,dir) shall select its behavior from the exact source and destination C++ types. If they are identical, it shall set top to the address of from, leave tmp unchanged and return V_EQ; it shall perform no numerical conversion or allocation. Otherwise it shall set top to the address of tmp, perform assign_r(tmp,from,dir) and return that operation's result. Its dispatch structs shall have the same behavior.
The operands shall remain live; temporary storage shall be initialized as required by the selected assignment. For differing types, the assignment's admitted values, rounding direction, aliasing, initialization, resource and exception conditions shall apply. If assignment throws, top shall already designate tmp and the assignment's destination guarantee shall apply. Borrowing shall not extend the source lifetime. A returned pointer shall not be used after its referent is destroyed or invalidated.
RATIONALE: Distance kernels can avoid a conversion and scratch write when the input already has the required exact type, while exposing conversion outcomes otherwise.
INTERFACE: Names belong to Parma_Polyhedra_Library unless qualified otherwise. Template excerpts omit SFINAE return-type restrictions described in the text.
template <typename To, typename From> Result maybe_assign(const To*&, To&, const From&, Rounding_Dir); template <typename To, typename From> struct maybe_assign_struct; // Static member of each general/same-type dispatch struct: static Result function(const To*&, To&, const From&, Rounding_Dir);
VERIFICATION_CRITERIA: Check address identity, untouched same-type scratch, value/result equivalence to explicit assignment for exact and directed inexact conversions, and selected assignment exceptions with top already changed. Exercise both the public helper and dispatch specializations.
SOURCE: src/distances_inlines.hh; tests/scalaradaptersspec1.cc.
-
1. Exact native integral and unbounded integer assignment to mpz storage UID: PPL-SPEC-000261 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: assign_r shall admit every native integral source type and Checked_Number<T, Check_Overflow_Policy<T>> source type in 🔗 1. Exact conversion between native and checked integral scalars, as well as a finite mpz_class source. The destination shall be mpz_class independently of the configured Coefficient alias. For each admitted source integer it shall assign the exact value and return V_EQ under all four base directions in 🔗 4. Rounding-direction intent, composition and inspection, with or without the strict-relation flag. This shall include all native signed and unsigned endpoints. An mpz_class source may be the destination itself, preserving its entry integer value.
The destination shall be live and assignable. A distinct source shall remain unchanged, and later destination mutation shall not affect a distinct source. Callers shall prevent concurrent access to an object while another operation modifies it. No library initialization object, thread initialization or coefficient-constant stage shall be required. This operation shall impose no fixed-width integer range bound; available resources shall limit storage. It shall return the conversion Result without policy-handler dispatch.
RATIONALE: An unbounded integer destination remains available even when the global coefficient alias is bounded. Embedding native endpoints must not pass through a narrower coefficient value.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source types:
Result assign_r(mpz_class& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check all eleven native types and their checked wrappers at zero, both signs and full signed/unsigned endpoints. Check multi-limb mpz assignment, self-aliasing, independent copying and every direction/strict flag with exact status. Run in every global coefficient profile without initialization stages.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerconversionspec1.cc; tests/numericpublic1.cc.
-
2. Directed canonical rational conversion to an unbounded integer UID: PPL-SPEC-000262 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a finite canonical mpq_class source with value a, assign_r into mpz_class with base direction ROUND_DOWN shall assign ⌊a⌋; base ROUND_UP shall assign ⌈a⌉. Rational canonical form shall follow 🔗 1. Exact rational assignment from rational and integral sources. The destination shall not designate the source rational's numerator or denominator object or overlap their storage. There shall be no fixed-width integer range bound.
Without ROUND_STRICT_RELATION, the downward request shall return V_GE and the upward request V_LE. These shall permit equality and shall not promise that an integral source has been classified as exact. With that flag, an integral source shall return V_EQ; a nonintegral source shall return V_GT downward and V_LT upward, with the relation orientation in 🔗 1. Numerical result classes and relation meanings.
No particular current hardware rounding direction shall be required and the current direction shall remain unchanged. Object validity, synchronization, source preservation, initialization independence and resource conditions shall follow 🔗 1. Exact native integral and unbounded integer assignment to mpz storage. This conversion shall require no shared temporary pool.
RATIONALE: A rational quotient can be rounded exactly using integer numerator and denominator operations. A weak result relation is a deliberate classification unless strict relation determination was requested.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source types:
Result assign_r(mpz_class& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use literal signed quotients and independent unbounded quotient/remainder calculations for exact integers, proper fractions, halves and large numerator/denominator values. Require the documented weak classifications without strict flags and definite classifications with them. Repeat under all hardware modes, preserving canonical source components.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerconversionspec1.cc; tests/numericpublic1.cc.
-
Incoming link from: 3. Numeric text input into integral destinations1
3. Delegated and exactness rational conversion to an unbounded integer UID: PPL-SPEC-000263 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For a finite canonical mpq_class source with value a, ROUND_IGNORE shall assign trunc(a) toward zero to the mpz_class destination. Without a strict flag it shall return V_LGE. ROUND_NOT_NEEDED shall require an integral canonical source, whose denominator is one, and shall assign that exact integer. Without a strict flag it shall return V_EQ in an assertion-enabled build and may return lazy V_LGE in a build defining NDEBUG, following 🔗 7. Internal no-rounding-needed request and result checking.
With ROUND_STRICT_RELATION, the delegated conversion shall report the definite relation: V_GT for a positive nonintegral source, V_LT for a negative nonintegral source, and V_EQ for an integral source. A strict no-rounding-needed request shall retain the integral-source precondition and return V_EQ.
Object, synchronization, source-preservation, resource and initialization conditions shall follow 🔗 1. Exact native integral and unbounded integer assignment to mpz storage. The rational-component nonaliasing condition in 🔗 2. Directed canonical rational conversion to an unbounded integer shall apply. No particular hardware rounding direction or shared temporary pool shall be required. The hardware direction shall remain unchanged and no fixed-width range limit shall apply.
RATIONALE: A delegated result may be lazy while still holding the correct truncated integer. An exactness request has an integral-source precondition, and a strict request resolves the otherwise weak relation.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source types:
Result assign_r(mpz_class& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check signed truncation using exact numerator/denominator answers, integral no-rounding-needed inputs in both build modes, and definite relations for strict delegated and exactness requests. Exercise large values, zero and proper fractions under all hardware modes without initialization stages.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerconversionspec1.cc.
-
4. Directed finite native floating-point conversion to mpz storage UID: PPL-SPEC-000264 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: The source shall be a finite float, double or long double whose corresponding PPL_SUPPORTED_FLOAT, PPL_SUPPORTED_DOUBLE or PPL_SUPPORTED_LONG_DOUBLE is nonzero. Its meaning shall be the exact represented binary value a. ROUND_DOWN shall assign ⌊a⌋ to mpz_class and ROUND_UP shall assign ⌈a⌉, with no fixed-width integer range restriction.
For float and double, a nonintegral source shall require the hardware rounding direction to be upward. An integral source shall return V_EQ; a nonintegral downward result shall return V_GT and an upward result V_LT, with or without the strict-relation flag. Exact integral inputs shall not require a particular current hardware direction.
For long double, no particular hardware direction shall be required. Without the strict flag the downward request shall return V_GE and the upward request V_LE. With the flag it shall return V_EQ for an integral source, V_GT for an inexact downward result and V_LT for an inexact upward result. This classification shall follow the exact rational route in 🔗 2. Directed canonical rational conversion to an unbounded integer, including when the native long double format has the same precision as double.
Object validity, source preservation, resource limits and initialization independence shall follow 🔗 1. Exact native integral and unbounded integer assignment to mpz storage. Current hardware rounding direction shall be preserved. The long double route shall use a lazily owned rational temporary; in a non-thread-safe configuration, concurrent calls sharing that temporary machinery shall be serialized, even on distinct argument objects. In a thread-safe configuration its pool shall belong to the calling thread. Unavailable native source types shall not be instantiated.
RATIONALE: All finite floating-point values have exact dyadic rational meanings and therefore admit unbounded integer bounds. Different native source routes may expose different relation precision without changing the integer result.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source types:
Result assign_r(mpz_class& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: For each configured source format, derive exact significand/power-of-two oracles for positive and negative fractions, subnormals, precision boundaries and finite maxima. Check strict and nonstrict result classifications separately for float/double versus long double. Use upward hardware direction for nonintegral float/double and every hardware direction for the rational long-double route; preserve source values and direction state.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerconversionspec1.cc.
-
5. Delegated finite floating-point conversion and exactness into mpz storage UID: PPL-SPEC-000265 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the configured finite source types in 🔗 4. Directed finite native floating-point conversion to mpz storage, ROUND_IGNORE shall assign trunc(a) toward zero to mpz_class. Without a strict flag it shall return V_LGE. ROUND_NOT_NEEDED shall require the represented source value to be an integer and shall assign that exact value. Without a strict flag it shall return V_EQ in an assertion-enabled build and may return lazy V_LGE in a build defining NDEBUG, following 🔗 7. Internal no-rounding-needed request and result checking.
With ROUND_STRICT_RELATION, delegated conversion shall determine V_GT for a positive nonintegral source, V_LT for a negative nonintegral source, and V_EQ for an integral source. A strict no-rounding-needed request shall retain its integral-source precondition and return V_EQ.
These requests shall require no particular current hardware rounding direction and shall preserve that direction. Object validity, source preservation, initialization independence, resource limits, availability and long-double temporary-pool ownership shall follow 🔗 4. Directed finite native floating-point conversion to mpz storage. No finite source shall overflow a fixed integer range or be classified as an infinite result merely because the selected global coefficient profile is bounded.
RATIONALE: An unbounded integer conversion avoids an artificial coefficient-width range failure. Delegated truncation and a strict relation request remain distinct guarantees for every native floating-point source route.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiation for the admitted source types:
Result assign_r(mpz_class& to, const From& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check exact and nonintegral signed dyadic values, zero, subnormals, native finite maxima and values beyond every bounded coefficient width. Verify lazy unflagged truncation, both build modes for exactness requests, definite strict relations, source preservation and unchanged hardware direction under all supported modes.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerconversionspec1.cc.
-
Incoming link from: 7. Raw scalar placement construction and exact assignment1
6. Finite native floating-point placement construction of an unbounded integer UID: PPL-SPEC-001196 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ, NATIVE_FP_AVAILABLE VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Internal RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: The source type F shall be float or double with its corresponding PPL_SUPPORTED_FLOAT or PPL_SUPPORTED_DOUBLE nonzero. The source shall be a live finite value with exact represented binary value a. The selected source and destination policies shall admit these finite values and provide the capabilities used by the native-to-mpz_class conversion. No policy rounding default or result handler shall be required.
The destination reference shall designate writable storage of at least sizeof(mpz_class) bytes, correctly aligned for mpz_class, with no live mpz_class occupying it. The storage shall be available for placement construction without ending an object lifetime that the caller must preserve. The source shall not overlap that storage. Before placement construction begins the destination glvalue shall be used only in ways permitted for storage outside an object's lifetime; it shall not be read as a live mpz_class. On normal return exactly one live mpz_class shall occupy the storage. Its caller shall arrange exactly one destruction of that object before releasing or reusing the storage.
ROUND_DOWN shall construct ⌊a⌋ and ROUND_UP shall construct ⌈a⌉. These requests shall return V_EQ for an integral source, otherwise V_GT downward or V_LT upward, with or without ROUND_STRICT_RELATION. ROUND_IGNORE shall construct trunc(a) and return V_LGE without the strict flag. With that flag it shall return V_EQ for an integral source, V_GT for a positive nonintegral source, and V_LT for a negative nonintegral source.
A raw kernel ROUND_NOT_NEEDED request shall require an integral source, construct its exact integer value and return V_LGE without the strict flag or V_EQ with it. A caller-translated ROUND_CHECK exactness request shall retain that integral-source precondition and return V_EQ. The public numerical construct adapter shall perform the direction and exactness-check translation in 🔗 7. Internal no-rounding-needed request and result checking before invoking this kernel. The kernel shall return Result without policy-handler dispatch.
A directed request on a nonintegral source shall require upward hardware rounding. Integral sources and delegated truncation shall require no particular current direction. Every call shall preserve the current hardware rounding direction. Floating-point exceptions shall be nontrapping; accrued exception flags shall be unspecified. Available GMP resources shall be required, without a fixed-width integer limit. No library/thread initialization owner, coefficient-constant stage or shared temporary pool shall be required. Callers shall synchronize storage use against concurrent access. Resource failure shall not be a successful result; no universal object-lifetime or storage-rollback guarantee shall be imposed after an abnormal exit.
RATIONALE: Placement construction begins an integer object's lifetime, whereas assignment requires an already live object. The numerical result and its relation must remain consistent with the requested rounding and exactness conventions without introducing a policy-handler decision.
INTERFACE: Internal header: src/checked_mpz_inlines.hh; namespace Parma_Polyhedra_Library::Checked; admitted F and policy types above:
template <typename To_Policy, typename From_Policy, typename F> Result construct_mpz_float(mpz_class& to, const F& from, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use correctly aligned raw storage and the admitted public numerical construct route or the internal kernel. After a successful construction, obtain the live object using the applicable C++ lifetime rules, compare it with an independent exact rational oracle, and destroy it exactly once. Check both source formats, both signs, zeros, nonintegral dyadic values, subnormals, finite maxima and exact integral values. Exercise all admitted directions and strict flags, including raw kernel exactness and the public adapter's debug/release translation. Check unchanged source values and hardware direction, definite strict relations, lazy unflagged relations, zero handler calls, and independence from the configured coefficient width. Do not inspect an unconstructed object or infer a general failure rollback.
SOURCE: src/checked_mpz_inlines.hh; src/checked_ext_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; tests/unboundedintegerconversionspec1.cc.
-
1. Numerical and geometric foundations UID: PPL-HLR-000001 STATUS: APPROVED COMPONENT: LIBRARY_WIDE APPLICABILITY: ALL VERIFICATION_METHODS: Test, Analysis, Review RELATIONS (Child): - PPL-LLR-000446 Reloadable textual representations (Refined by)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Refined by)
- PPL-LLR-000012 Affine meaning of linear expressions (Refined by)
- PPL-LLR-000013 Meaning of linear constraints (Refined by)
- PPL-LLR-000014 Meaning of linear congruences (Refined by)
- PPL-LLR-000015 Distinct meanings of geometric generators (Refined by)
- PPL-LLR-000001 Exact integral coefficient calculations (Refined by)
- PPL-LLR-000002 Detection of checked coefficient overflow (Refined by)
- PPL-LLR-000003 Conservative directed numerical bounds (Refined by)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Refined by)
- PPL-LLR-000414 Integer quotient and remainder semantics (Refined by)
- PPL-LLR-000415 Exact rational arithmetic (Refined by)
STATEMENT: PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.
RATIONALE: Domains and solvers need a common interpretation of coefficients, coordinates, expressions, constraints and generators.
VERIFICATION_CRITERIA: Review the common mathematical definitions and their consistency across domains; exercise representative descriptor construction, arithmetic and dimension changes under each supported numerical configuration.
BIBLIOGRAPHY: BagnaraHZ08SCP | Whole work (background on the library's numerical abstractions and design).
SOURCE: doc/definitions.dox: Basic_Geometric_Descriptors, Syntactic_Geometric_Descriptors; src/Coefficient_defs.hh; src/Linear_Expression_defs.hh.
- PPL-SPEC-000044 Coefficient quotient and remainder with truncation toward zero (Specified by)
- PPL-SPEC-000048 Coefficient scaling and truncated division by powers of two (Specified by)
- PPL-SPEC-000053 Coefficient remainder assignment and exact division (Specified by)
- PPL-SPEC-000832 Directed native integer division and delegated truncation (Specified by)
- PPL-SPEC-000833 Exact native truncated quotient and remainder (Specified by)
- PPL-SPEC-000838 Directed native integer division by powers of two (Specified by)
- PPL-SPEC-000839 Centered and nonnegative native integer dyadic residues (Specified by)
- PPL-SPEC-000095 Truncated rational quotient and signed rational remainder (Specified by)
- PPL-SPEC-000513 Directed unbounded integer division and explicit delegated convention (Specified by)
- PPL-SPEC-000514 Exact truncated unbounded integer quotient and remainder (Specified by)
- PPL-SPEC-000515 Unbounded integer arithmetic with powers of two (Specified by)
- PPL-SPEC-000516 Exact centered and nonnegative unbounded integer residues (Specified by)
PPL shall provide integer quotient and remainder operations for its supported integer numeric profiles, with defined quotient-rounding and remainder-sign conventions. For valid operands within the selected arithmetic preconditions, completed operations shall satisfy their specified convention and the corresponding dividend-reconstruction identity.
Division and remainder conventions differ for negative operands. Exact coefficient addition and multiplication alone do not define these arithmetic foundations.
Verification covers integer division and remainder operations, their rounding conventions, valid operand ranges and reported outcomes. Related obligations: 🔗 1. Exact integral coefficient calculations, 🔗 2. Detection of checked coefficient overflow, 🔗 1. Meaning of successful exact and approximate results.
Compare quotient and remainder pairs with independent integer calculations for every supported convention. Include every sign combination, exact and inexact division, zero dividends and representable range boundaries. Exclude a zero divisor and other documented invalid operand combinations from successful-result checks; assess any promised rejection or failure separately.
src/checked_defs.hh: integer division and remainder operations. src/checked_int_inlines.hh: bounded integer quotient and remainder. src/checked_mpz_inlines.hh: unbounded integer operations.
-
4. Coefficient quotient and remainder with truncation toward zero UID: PPL-SPEC-000044 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For live finite coefficients with entry values a and nonzero b, a successfully materialized quotient shall be q = trunc(a ⁄ b). A materialized remainder shall be r = a − bq, with |r| < |b|; a nonzero remainder shall have the sign of a. Quotient calculation shall require q to be representable. In a bounded profile, dividing the least representable integer by -1 shall therefore be outside this successful-quotient precondition.
Remainder calculation shall admit every representable dividend and nonzero representable divisor, including that least-integer/-1 pair, and shall return zero for that pair. The mathematical definition of r shall not require the caller to compute an unrepresentable bounded quotient or intermediate product.
Compound division and remainder shall compute the corresponding result from entry values, replace the target and return a reference to it. The divisor may designate that target when its entry value is nonzero. Distinct operands shall remain unchanged. No zero-divisor rejection guarantee shall be inferred from these valid-input contracts. Materialization, thread initialization and synchronization shall follow 🔗 3. Exact ordinary integral coefficient arithmetic.
RATIONALE: Negative operands distinguish truncation toward zero from floor division. Remainder can remain representable even where its corresponding bounded quotient is not.
INTERFACE: Public header: <ppl.hh>. For live Coefficient operands a and b satisfying the respective preconditions:
Coefficient quotient(a / b); Coefficient remainder(a % b); Coefficient& divided = (a /= b); Coefficient& reduced = (a %= b);
The quotient and remainder forms shall have the same stated conventions in GMP, checked bounded and native bounded profiles.
VERIFICATION_CRITERIA: Use literal quotient/remainder answers for every sign combination, exact and inexact division, zero dividends, unit divisors and bounded endpoints. Verify reconstruction with an unbounded oracle, not overflowing bounded intermediates. Check MIN remainder -1 separately from the excluded native quotient. Exercise compound/self-aliasing forms and preserve distinct operands.
SOURCE: src/Coefficient_types.hh; src/Checked_Number_inlines.hh; src/checked_int_inlines.hh; GMP integer provider; tests/coefficient2.cc.
-
8. Coefficient scaling and truncated division by powers of two UID: PPL-SPEC-000048 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For a live finite coefficient with entry value a and an unsigned exponent e, successful mul_2exp_assign(x, y, e) shall assign a2e to x, where a is y's entry value. Successful div_2exp_assign(x, y, e) shall assign trunc(a ⁄ 2e) to x. Truncation shall be toward zero for either sign. The exponent zero shall preserve the input value.
The destination may be the source itself. A distinct source shall remain unchanged. A successful bounded multiplication result shall be representable. For native bounded multiplication, the exponent shall additionally be less than the selected width. These conditions shall include multiplying -1 by the power whose exponent is one less than that width, producing the least representable integer without undefined intermediate signed overflow.
Bounded division shall admit every unsigned int exponent; an exponent at least as large as the coefficient width shall produce zero. Checked bounded multiplication shall also admit every such exponent: a zero source shall produce zero, while a nonzero source with an exponent at least as large as the width shall report overflow. The mpz profile shall admit the unsigned int exponent range subject to available computational resources.
Checked bounded multiplication whose result is outside the coefficient range, with other input prerequisites satisfied, shall report std::overflow_error and retain the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. Native bounded operations shall not promise overflow detection. The initialized-thread and synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply.
RATIONALE: Scaling by powers of two is an integer operation, including at the negative range boundary. A representable result must not be invalidated by an overflowing signed intermediate. Division must retain the same truncation convention as ordinary integer quotient calculation.
INTERFACE: Public header: <ppl.hh>. For Coefficient operands in Parma_Polyhedra_Library, the selected provider shall admit:
void mul_2exp_assign(Coefficient& x, const Coefficient& y, unsigned int exp); void div_2exp_assign(Coefficient& x, const Coefficient& y, unsigned int exp);
For a bounded profile these callable forms are supplied by function-template instantiations for the configured coefficient type.
VERIFICATION_CRITERIA: Check zero and nonzero exponents, positive and negative inputs, zero values, destination/source aliasing and preservation of distinct sources. Include the negative sign-bit boundary in every bounded width, multi-limb GMP values, and literal signed-division answers. Compare checked positive and negative overflow with the required exception and explicitly reassign surviving outputs. Run native valid-result cases under undefined-behavior sanitization and confirm that introducing an overflowing signed intermediate is detected by the boundary regression.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh: GMP helpers. src/Checked_Number_inlines.hh: bounded coefficient helper dispatch. src/checked_int_inlines.hh: bounded scaling and division. tests/coefficient2.cc: configured dyadic arithmetic and boundary cases.
-
Incoming link from: 2. Checked named remainder and exact quotient1
3. Coefficient remainder assignment and exact division UID: PPL-SPEC-000053 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000002 Detection of checked coefficient overflow (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For source entry values a and nonzero b, rem_assign(x, y, z) shall assign r = a − btrunc(a ⁄ b), where y supplies a and z supplies b. A nonzero remainder shall have the dividend's sign and satisfy |r| < |b|. This shall admit the bounded minimum divided by -1 and assign zero without requiring a representable quotient.
exact_div_assign(x, y, z) shall require nonzero b and exact divisibility of a by b. On success it shall assign a ⁄ b. The quotient shall be representable for successful bounded use. A checked quotient outside that range shall report std::overflow_error with the surviving-output guarantee of 🔗 5. Checked coefficient overflow and result-policy dispatch. No invalid divisor or nondivisibility rejection shall be promised.
For either operation the destination may be either source, including when both sources denote the same nonzero object; calculations shall use entry values.
The initialized-thread and object-synchronization conditions of 🔗 2. Finite coefficient construction, copying and comparison shall apply. Distinct source objects shall remain unchanged. The mpz profile shall be subject to available computational resources.
RATIONALE: Exact division has a stronger input precondition than truncated quotient calculation. An explicit remainder assignment must preserve the already defined signed convention even where the corresponding bounded quotient cannot be represented.
INTERFACE: Public header: <ppl.hh>. For operands satisfying the respective preconditions, the selected provider shall admit:
void rem_assign(Coefficient& x, const Coefficient& y, const Coefficient& z); void exact_div_assign(Coefficient& x, const Coefficient& y, const Coefficient& z);
The bounded forms shall be function-template instantiations.
VERIFICATION_CRITERIA: Check every dividend/divisor sign combination, exact and inexact remainders, zero dividends and unit divisors against literal or unbounded answers. Exercise separate output, dividend alias, divisor alias and all-same nonzero arguments. Check MIN remainder -1 and checked MIN exact division by -1 separately.
SOURCE: src/GMP_Integer_defs.hh and src/GMP_Integer_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/coefficient4.cc.
-
2. Directed native integer division and delegated truncation UID: PPL-SPEC-000832 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For argument types, entry-operand finite ranges and lifetime/alias prerequisites from 🔗 1. Exact same-storage native integer arithmetic, let the divisor b be nonzero and let q = a ⁄ b be the exact rational quotient. div_assign_r with ROUND_DOWN shall assign ⌊q⌋; with ROUND_UP it shall assign ⌈q⌉. A successful result shall give a relation containing the exact ordering of q relative to the stored integer. With ROUND_STRICT_RELATION, it shall identify precisely equality, strict greater-than or strict less-than through V_EQ, V_GT or V_LT.
ROUND_IGNORE shall store the quotient truncated toward zero and may return a relation containing equality and either strict order. A strict request shall identify the exact relation between q and that stored integer. ROUND_NOT_NEEDED shall require an exact representable quotient; it shall store that quotient and return a relation admitting equality. A strict exactness request shall return V_EQ. An out-of-range quotient shall follow 🔗 4. Checked native arithmetic range outcomes when checking is enabled, and shall be outside the unchecked successful-result precondition otherwise.
Quotient rounding and relation classification shall use entry operands even if the destination aliases the dividend or divisor. Sources not sharing the destination shall remain unchanged. Calls shall retain the handler, initialization, synchronization and hardware-direction conditions of 🔗 1. Exact same-storage native integer arithmetic.
RATIONALE: Bounded integer division needs a defined rounding convention and an honest relation to the exact rational quotient, including delegated truncation.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for the admitted argument types:
Result div_assign_r(To& to, const X& x, const Y& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Derive floor, ceiling and truncation from independent unbounded integer quotient/remainder calculations for every sign combination. Check exact and inexact quotients, zero dividends, full signed and unsigned endpoints, all admitted rounding and strictness requests, source aliases and preserved entry values. Assess checked range failure separately from successful representable division.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_ext_inlines.hh; tests/nativeintegerarithmeticspec1.cc.
-
3. Exact native truncated quotient and remainder UID: PPL-SPEC-000833 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the same-storage finite operands and prerequisites of 🔗 1. Exact same-storage native integer arithmetic and a nonzero divisor b, idiv_assign_r shall assign the exact integer t = trunc(a ⁄ b) and rem_assign_r shall assign r = a − tb. For representable results, both shall return V_EQ for every valid rounding request, with or without ROUND_STRICT_RELATION. The named integer quotient shall not change to a floor or ceiling when the direction changes.
The identity a = tb + r shall hold mathematically. A nonzero remainder shall have the dividend's sign and satisfy |r| < |b|. Unsigned remainders shall be nonnegative. In particular, a signed minimum integer's remainder modulo -1 shall be exactly zero even when the corresponding positive quotient is outside storage range. The quotient's checked range outcome shall follow 🔗 4. Checked native arithmetic range outcomes; the remainder shall not require that quotient to be representable as an intermediate native integer.
Each operation shall permit every alias described by 🔗 1. Exact same-storage native integer arithmetic, using entry operands and preserving distinct sources. Its handler, initialization, synchronization and hardware-direction conditions shall follow that contract. ROUND_NOT_NEEDED shall require the selected operation's own integer result to be representable; it shall not require a ⁄ b itself to be integral when requesting the truncated quotient or remainder.
RATIONALE: A truncated quotient and its remainder are exact integer operations. A quotient overflow must not prohibit a representable remainder or cause native undefined division during its computation.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for the admitted argument types:
Result idiv_assign_r(To& to, const X& x, const Y& y, Rounding_Dir dir); Result rem_assign_r(To& to, const X& x, const Y& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check independent unbounded quotient/remainder and reconstruction oracles for all operand signs, exact and inexact division, zero dividends, every standard native storage type and endpoint values. Include signed minimum modulo minus one, all valid requests and every source/output alias. Check quotient overflow through its separate range contract.
SOURCE: src/checked_int_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_ext_inlines.hh; tests/nativeintegerarithmeticspec1.cc.
-
Incoming link from: 5. Checked named scaling by powers of two1
2. Directed native integer division by powers of two UID: PPL-SPEC-000838 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For the same-storage finite entry values and prerequisites in 🔗 1. Exact same-storage native integer arithmetic, div_2exp_assign_r shall divide the exact integer source by 2e, for every unsigned int exponent e. ROUND_DOWN shall store its floor, ROUND_UP its ceiling and ROUND_IGNORE its truncation toward zero. Every stored result shall be finite and representable. No exponent shall cause an invalid native shift, including one equal to or greater than the storage width.
A successful result shall report a relation containing the exact rational quotient's ordering relative to the stored integer. With ROUND_STRICT_RELATION it shall return precisely V_EQ, V_GT or V_LT for equality, an exact quotient greater than the stored result, or one smaller than it. ROUND_NOT_NEEDED shall require exact divisibility by 2e; it shall store the exact quotient and return a relation admitting equality. Its strict form shall return V_EQ.
An exponent of zero shall preserve the integer value. For exponents greater than the storage width, a nonzero positive source shall have floor zero and ceiling one; a negative source shall have floor minus one and ceiling zero. Delegated truncation shall give zero in both cases. Zero shall remain zero for every exponent. Source aliases, preservation, handler independence, initialization, synchronization and hardware-direction conditions shall follow 🔗 1. Exact same-storage native integer arithmetic.
RATIONALE: Integer division by a power of two must retain its directed mathematical meaning beyond the native shift width, including negative fractions and exactness classification.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for admitted argument types:
Result div_2exp_assign_r(To& to, const From& source, unsigned int e, Rounding_Dir dir);
VERIFICATION_CRITERIA: Derive exact quotient/remainder, directed integer and relation oracles using unbounded arithmetic or symbolic signs for very large exponents. Exercise all eleven storage types, every valid request, signed zero-crossing cases, finite endpoints, exact divisibility and exponents through UINT_MAX. Check same-object assignment, raw/checked forms, unchanged sources and hardware direction without library initialization.
SOURCE: src/checked_int_inlines.hh; src/checked_ext_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; tests/nativeintegerdyadicspec1.cc.
-
Incoming link from: 4. Outward endpoint residues modulo powers of two1
3. Centered and nonnegative native integer dyadic residues UID: PPL-SPEC-000839 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the same-storage finite entry operands and prerequisites in 🔗 1. Exact same-storage native integer arithmetic, let m = 2e, where e is any unsigned int exponent. umod_2exp_assign_r shall assign the unique integer u with 0 ≤ u < m and x − u divisible by m. smod_2exp_assign_r shall assign s = u when 2u < m, and s = u − m otherwise. The centered interval shall therefore be [ − m ⁄ 2, m ⁄ 2); an exact half-modulus tie shall select its negative representative. Exponent zero shall give zero for both operations.
A representable finite residue shall return V_EQ for every valid rounding request, including strict requests. The rounding direction shall not choose a different residue convention. When checking is enabled, a residue outside the policy's finite interval shall instead have the range outcome of 🔗 4. Checked native arithmetic range outcomes, using that residue as the exact requested integer. Reserved infinity/NaN representations shall not be reported as successful finite residues. This shall include negative centered residues in unsigned storage and nonnegative signed-storage residues crossing a policy-reserved upper endpoint.
Unchecked calls shall require the selected residue to be finite and representable. ROUND_NOT_NEEDED shall require representability, with or without a strict flag. No exponent shall cause an invalid native shift. The source and destination may alias, and a distinct source shall remain unchanged. Handler independence, output reusability after an unrepresentable range outcome, initialization, lifetime, synchronization and preserved hardware direction shall follow 🔗 1. Exact same-storage native integer arithmetic and 🔗 4. Checked native arithmetic range outcomes.
RATIONALE: A residue convention includes its sign and half-modulus tie rule. Its exact mathematical value must also respect the selected policy finite interval, which may be smaller than the underlying native storage range.
INTERFACE: Public header: <ppl.hh>; effective instantiations in Parma_Polyhedra_Library for admitted argument types:
Result smod_2exp_assign_r(To& to, const From& source, unsigned int e, Rounding_Dir dir); Result umod_2exp_assign_r(To& to, const From& source, unsigned int e, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use independent nonnegative modulo and centered tie oracles for all native types, zero, both signs, finite endpoints, half-modulus boundaries, exponent zero and storage-width boundaries through UINT_MAX. Check exact payloads or literal policy-aware range outcomes, source aliases, raw/checked forms and all valid requests. Include unsigned negative centered results and signed nonnegative residues at policy-reserved positive endpoints.
SOURCE: src/checked_int_inlines.hh; src/checked_ext_inlines.hh; src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; tests/nativeintegerdyadicspec1.cc.
-
Incoming links from: 1. Same-storage checked compound arithmetic 2. Checked named remainder and exact quotient2
5. Truncated rational quotient and signed rational remainder UID: PPL-SPEC-000095 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For rational source entry values a and nonzero b, idiv_assign_r(to, x, y, dir) shall assign q = trunc(a ⁄ b) as a canonical rational with denominator one. rem_assign_r(to, x, y, dir) shall assign r = a − btrunc(a ⁄ b). The remainder shall satisfy |r| < |b|; a nonzero remainder shall have the sign of a. Each successful call shall return V_EQ for its specified operation.
The two sources may be the same object. The directions ROUND_DOWN, ROUND_UP, ROUND_IGNORE and ROUND_NOT_NEEDED, with an optional ROUND_STRICT_RELATION flag, shall not change these truncation and remainder conventions or the returned exact status. A zero-divisor rejection guarantee shall not be inferred from this contract.
Canonical operands, synchronization and resource prerequisites shall follow 🔗 1. Exact rational assignment from rational and integral sources. The destination shall be a live rational object and may be any source; the operation shall use every operand's entry value. Distinct sources shall remain unchanged.
With a non-thread-safe build, calls to rem_assign_r shall not overlap PPL arithmetic in another thread. A thread-safe build shall provide independent temporary storage for each thread.
RATIONALE: The rational remainder convention derives from truncating the ratio, rather than from independently rounding the dividend or divisor to integers.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for mpq_class:
Result idiv_assign_r(mpq_class& to, const mpq_class& x, const mpq_class& y, Rounding_Dir dir); Result rem_assign_r(mpq_class& to, const mpq_class& x, const mpq_class& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check literal quotient/remainder pairs for every sign combination, proper and improper rational ratios, exact division and zero dividends. Verify reconstruction and remainder bounds with independent integer numerator/denominator calculations. Exercise both input aliases and all-same nonzero calls, exact status and canonical representation.
SOURCE: src/checked_mpq_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/rationalnumerics1.cc.
-
3. Directed unbounded integer division and explicit delegated convention UID: PPL-SPEC-000513 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For the mpz_class objects and prerequisites in 🔗 1. Exact named arithmetic on unbounded integer storage, the divisor b shall be nonzero. Let q = a ⁄ b denote the exact rational quotient. div_assign_r with ROUND_DOWN shall assign ⌊q⌋ and return V_GE; with ROUND_UP it shall assign ⌈q⌉ and return V_LE. With ROUND_STRICT_RELATION, a directed request shall instead return V_EQ when q is integral, otherwise V_GT for downward rounding or V_LT for upward rounding.
ROUND_IGNORE shall use the ceiling convention and return a relation containing q ≤ to. A strict delegated request shall identify equality or strict inequality. ROUND_NOT_NEEDED shall require b to divide a exactly, assign the exact integer quotient and return a relation admitting equality; with ROUND_STRICT_RELATION it shall return V_EQ. The exactness decision shall use entry operands even when the output aliases either source. Other alias, preservation, resource, initialization and hardware independence conditions shall follow 🔗 1. Exact named arithmetic on unbounded integer storage.
RATIONALE: Integer storage requires an explicit floor, ceiling or delegated convention for a nonintegral quotient. Entry-operand exactness prevents an aliased write from changing the reported relation.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result div_assign_r(mpz_class& to, const mpz_class& x, const mpz_class& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Use an independent integer long-division oracle for all source signs, exact and inexact division, zero dividends and large magnitudes. Check all valid admitted requests, relation strictness, source/destination aliases, shared operands, reconstruction inequalities and source preservation.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerarithmeticspec1.cc.
-
Incoming links from: 1. Same-storage checked compound arithmetic 2. Checked named remainder and exact quotient2
4. Exact truncated unbounded integer quotient and remainder UID: PPL-SPEC-000514 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For the mpz_class objects and prerequisites in 🔗 1. Exact named arithmetic on unbounded integer storage, with nonzero divisor b, idiv_assign_r shall assign n = trunc(a ⁄ b) toward zero and rem_assign_r shall assign r = a − nb exactly. They shall satisfy |r| < |b|; a nonzero r shall have the dividend's sign. All valid rounding requests, including strict and exactness requests, shall return V_EQ and shall not change these conventions. No divisibility precondition shall be imposed by ROUND_NOT_NEEDED because the specified truncated quotient and remainder are themselves exact integers.
Each output may alias either source, the sources may alias each other, and all entry values shall retain their formula meaning. Distinct source objects shall remain unchanged. Resource, range, synchronization and initialization independence shall follow 🔗 1. Exact named arithmetic on unbounded integer storage.
RATIONALE: Truncated quotient and remainder differ from directed rational division and together provide an exact dividend reconstruction for negative as well as positive operands.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result idiv_assign_r(mpz_class& to, const mpz_class& x, const mpz_class& y, Rounding_Dir dir); Result rem_assign_r(mpz_class& to, const mpz_class& x, const mpz_class& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Independently derive quotient and remainder by integer long division. Check all sign combinations, zero, unit divisors, exact and inexact division and very large operands, reconstruction, strict magnitude and sign rules, all eight requests and aliases.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerarithmeticspec1.cc.
-
5. Unbounded integer arithmetic with powers of two UID: PPL-SPEC-000515 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): - PPL-LLR-000001 Exact integral coefficient calculations (Specifies)
- PPL-LLR-000003 Conservative directed numerical bounds (Specifies)
- PPL-LLR-000414 Integer quotient and remainder semantics (Specifies)
- PPL-LLR-000301 Meaning of successful exact and approximate results (Specifies)
- PPL-LLR-000311 Public C++ access to supported facilities (Specifies)
- PPL-LLR-000442 Explicit numerical operation contracts (Specifies)
STATEMENT: For mpz_class objects and prerequisites in 🔗 1. Exact named arithmetic on unbounded integer storage, let e be an unsigned exponent and m = 2e. Resources shall suffice for the requested power and output; there shall be no native shift-width precondition on e. add_2exp_assign_r, sub_2exp_assign_r and mul_2exp_assign_r shall assign exactly a + m, a − m and am, respectively, and return V_EQ for every valid rounding request.
div_2exp_assign_r shall round a ⁄ m downward or upward with the same directed value and relation rules as 🔗 3. Directed unbounded integer division and explicit delegated convention. ROUND_IGNORE shall truncate toward zero and return a relation admitting the actual comparison; a strict delegated request shall distinguish equality and strict inequality. ROUND_NOT_NEEDED shall require m to divide a, assign the exact quotient and return a relation admitting equality; a strict exactness request shall return V_EQ. This delegated truncation convention shall apply to power-of-two division independently of the ceiling convention for general div_assign_r.
Source/destination aliases, source preservation and other prerequisites shall follow 🔗 1. Exact named arithmetic on unbounded integer storage. Shared scratch-integer pools used to form an additive power shall be serialized in a build without thread-safe support; thread-safe configurations shall use calling-thread pools. No FPU setup, initialized library owner or coefficient-constant stage shall be needed.
RATIONALE: Unbounded integer shifts must not inherit a native coefficient width limit, while division still needs an explicit rounding convention and exactness precondition.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result add_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result sub_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result mul_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result div_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir);
VERIFICATION_CRITERIA: Exercise exponent zero, native-width boundaries and exponents above every bounded coefficient width with literal or independently derived integer powers. Check all signs, exact/inexact division, strict and delegated outcomes, aliases, source preservation and exactness requests when divisible.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerarithmeticspec1.cc.
-
Incoming link from: 4. Outward endpoint residues modulo powers of two1
6. Exact centered and nonnegative unbounded integer residues UID: PPL-SPEC-000516 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPZ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For mpz_class objects, exponent e and modulus m = 2e as in 🔗 5. Unbounded integer arithmetic with powers of two, umod_2exp_assign_r shall assign the unique integer residue u ∈ [0, m) congruent to the source a modulo m. For e > 0, smod_2exp_assign_r shall assign the unique congruent integer s ∈ [ − m ⁄ 2, m ⁄ 2). For e = 0, both operations shall assign zero. At a positive half-modulus tie, the centered operation shall select the negative half-modulus.
Both operations shall be exact and return V_EQ for every valid rounding request, including strict and exactness requests, without a divisibility precondition. Output/source aliases shall be permitted and distinct sources shall remain unchanged. Range, resources, synchronization, initialization and hardware independence shall follow 🔗 1. Exact named arithmetic on unbounded integer storage. The exponent shall not be limited by a native shift width or the configured coefficient range.
RATIONALE: Exact modular reduction needs explicit interval and half-modulus tie conventions, including the degenerate modulus one.
INTERFACE: Public header: <ppl.hh>; effective template instantiations in Parma_Polyhedra_Library:
Result smod_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir); Result umod_2exp_assign_r(mpz_class& to, const mpz_class& from, unsigned exp, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check positive and negative inputs, zero, exact multiples, both half-modulus boundaries and their neighbors, exponent zero and very large powers. Derive independent quotient/remainder witnesses, prove congruence and interval bounds, and test all eight requests and aliases.
SOURCE: src/checked_mpz_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/unboundedintegerarithmeticspec1.cc.
-
1. Numerical and geometric foundations UID: PPL-HLR-000001 STATUS: APPROVED COMPONENT: LIBRARY_WIDE APPLICABILITY: ALL VERIFICATION_METHODS: Test, Analysis, Review RELATIONS (Child): - PPL-LLR-000446 Reloadable textual representations (Refined by)
- PPL-LLR-000011 Coordinate identity and ambient dimension (Refined by)
- PPL-LLR-000012 Affine meaning of linear expressions (Refined by)
- PPL-LLR-000013 Meaning of linear constraints (Refined by)
- PPL-LLR-000014 Meaning of linear congruences (Refined by)
- PPL-LLR-000015 Distinct meanings of geometric generators (Refined by)
- PPL-LLR-000001 Exact integral coefficient calculations (Refined by)
- PPL-LLR-000002 Detection of checked coefficient overflow (Refined by)
- PPL-LLR-000003 Conservative directed numerical bounds (Refined by)
- PPL-LLR-000004 Meaning of numerical conversion outcomes (Refined by)
- PPL-LLR-000414 Integer quotient and remainder semantics (Refined by)
- PPL-LLR-000415 Exact rational arithmetic (Refined by)
STATEMENT: PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.
RATIONALE: Domains and solvers need a common interpretation of coefficients, coordinates, expressions, constraints and generators.
VERIFICATION_CRITERIA: Review the common mathematical definitions and their consistency across domains; exercise representative descriptor construction, arithmetic and dimension changes under each supported numerical configuration.
BIBLIOGRAPHY: BagnaraHZ08SCP | Whole work (background on the library's numerical abstractions and design).
SOURCE: doc/definitions.dox: Basic_Geometric_Descriptors, Syntactic_Geometric_Descriptors; src/Coefficient_defs.hh; src/Linear_Expression_defs.hh.
For numeric profiles supporting exact rational values, PPL shall provide addition, subtraction, multiplication and division by a nonzero rational. For valid operands within the arithmetic and resource preconditions, successfully completed operations shall produce the exact mathematical rational result.
Exact rational arithmetic supports domain bounds, optimization results and independent numerical reasoning. A rational-valued operation is distinct from an integer coefficient profile.
The scalar facet selects rational-valued use contexts; it does not introduce a global rational coefficient configuration.
Verification covers rational numeric value types and exact rational arithmetic operations. Related obligations: 🔗 1. Exact integral coefficient calculations, 🔗 4. Meaning of numerical conversion outcomes, 🔗 1. Meaning of successful exact and approximate results.
Compare results with independently reduced numerator-and-denominator calculations. Include negative values, cancellation, nonintegral quotients, equivalent unreduced fractions and large representable operands. Check that canonicalization preserves rational value and treat zero-denominator requests according to their separate preconditions and failure contracts.
src/checked_mpq_inlines.hh: exact rational operations and normalization. src/Checked_Number_defs.hh: supported rational values and arithmetic. src/Result_defs.hh: arithmetic outcome classifications.
-
Incoming links from: 1. Same-storage checked compound arithmetic 2. Checked named remainder and exact quotient2
3. Exact finite rational addition, subtraction, multiplication and division UID: PPL-SPEC-000093 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For source entry values a and b, add_assign_r, sub_assign_r and mul_assign_r shall assign a + b, a − b and ab, respectively. div_assign_r shall require b ≠ 0 and assign a ⁄ b. Each successful operation shall produce a canonical rational and return V_EQ. This shall include cancellation, zero numerators and arbitrarily large finite integral numerator or denominator values within available resources.
The two sources may be the same object. The directions ROUND_DOWN, ROUND_UP, ROUND_IGNORE and ROUND_NOT_NEEDED, with an optional ROUND_STRICT_RELATION flag, shall not change the exact value or status. A transparent rational policy shall not promise rejection of a zero divisor.
Canonical operands, synchronization and resource prerequisites shall follow 🔗 1. Exact rational assignment from rational and integral sources. The destination shall be a live rational object and may be any source; the operation shall use every operand's entry value. Distinct sources shall remain unchanged.
RATIONALE: The rational arithmetic interface returns an explicit exactness classification while retaining mathematical values and canonical representation across aliases.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for mpq_class:
Result add_assign_r(mpq_class& to, const mpq_class& x, const mpq_class& y, Rounding_Dir dir); Result sub_assign_r(mpq_class& to, const mpq_class& x, const mpq_class& y, Rounding_Dir dir); Result mul_assign_r(mpq_class& to, const mpq_class& x, const mpq_class& y, Rounding_Dir dir); Result div_assign_r(mpq_class& to, const mpq_class& x, const mpq_class& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check literal reduced fractions and independent cross-product identities for both signs, zero and cancellation. Exercise distinct output, each input alias and all-same inputs, respecting nonzero division. Verify exact status and canonical output under every supported direction, with multi-limb inputs in all coefficient configurations.
SOURCE: src/checked_mpq_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/rationalnumerics1.cc; tests/numericpublic1.cc.
-
Incoming link from: 4. Checked named product accumulation1
7. Exact rational product accumulation and subtraction UID: PPL-SPEC-000097 STATUS: APPROVED COMPONENT: NUMERICS APPLICABILITY: IF_CPP, SCALAR_MPQ VERIFICATION_METHODS: Test, Analysis, Inspection LANGUAGE: CPP VISIBILITY: Public RELATIONS (Parent): STATEMENT: For destination and source entry values d, a and b, add_mul_assign_r shall assign d + ab and sub_mul_assign_r shall assign d − ab. Each successful call shall produce a canonical rational and return V_EQ. The destination may be either or both sources; the two sources may be the same object.
ROUND_DOWN, ROUND_UP, ROUND_IGNORE and ROUND_NOT_NEEDED, with an optional ROUND_STRICT_RELATION flag, shall not change the exact value or status. There shall be no bounded coefficient intermediate-range restriction on these rational operations.
Canonical operands, synchronization and resource prerequisites shall follow 🔗 1. Exact rational assignment from rational and integral sources. The destination shall be a live rational object and may be any source; the operation shall use every operand's entry value. Distinct sources shall remain unchanged.
RATIONALE: Product accumulation must evaluate all three entry values consistently, including when a GMP expression references its own destination.
INTERFACE: Public header: <ppl.hh>; effective PPL template instantiations for mpq_class:
Result add_mul_assign_r(mpq_class& to, const mpq_class& x, const mpq_class& y, Rounding_Dir dir); Result sub_mul_assign_r(mpq_class& to, const mpq_class& x, const mpq_class& y, Rounding_Dir dir);
VERIFICATION_CRITERIA: Check literal reduced answers for both operations, every source/destination alias partition, zero factors, mixed signs, cancellation and large numerator/denominator products. Verify exact status, canonical output and unchanged distinct sources across admitted directions.
SOURCE: src/checked_mpq_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/rationalnumerics1.cc.