-
1. Numerical and geometric foundations PPL-HLR-000001 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.
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.
-
16. Complete-tree cursor positions, topology and occupied-node search PPL-SPEC-001629 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.
-
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 PPL-SPEC-000041 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.
-
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 PPL-SPEC-000042 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.
-
3. Exact ordinary integral coefficient arithmetic PPL-SPEC-000043 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.
-
8. Coefficient scaling and truncated division by powers of two PPL-SPEC-000048 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.
-
2. Coefficient negation and absolute-value assignment PPL-SPEC-000052 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.
-
Incoming link from: 1. Native integer accumulated products and intermediate overflow1
6. Integral product accumulation and subtraction PPL-SPEC-000056 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.
-
Incoming link from: 6. Sparse equality and line pivot selection1
1. Forward elimination and augmented equality/line rank PPL-SPEC-000425 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.
-
2. Back substitution through a triangular nonconstant basis PPL-SPEC-000426 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.
-
3. Simplification of equality and line subsystems PPL-SPEC-000427 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.
-
4. Sorting rows together with their saturation records PPL-SPEC-000428 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.
-
5. Adding processed rows for new coordinate axes PPL-SPEC-000429 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.
-
6. Sparse equality and line pivot selection PPL-SPEC-001649 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.
-
18. Row-wise normalization and certificate invalidation PPL-SPEC-000418 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.
-
Incoming link from: 4. Checked named product accumulation1
1. Native integer accumulated products and intermediate overflow PPL-SPEC-000842 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.
-
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 PPL-SPEC-000831 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.
-
Incoming link from: 5. Checked named scaling by powers of two1
1. Native integer arithmetic with exact powers of two PPL-SPEC-000837 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.
-
11. Native integer overflow primitives PPL-SPEC-001663 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.
-
16. GCD normalization of raw coefficient vectors PPL-SPEC-000296 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.
-
17. Support-aware callback combinations PPL-SPEC-000297 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.
-
Incoming link from: 19. Range-limited linear combinations preserve outside coordinates1
18. Whole-row linear combinations across row storage PPL-SPEC-000298 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.
-
19. Range-limited linear combinations preserve outside coordinates PPL-SPEC-000299 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.
-
Incoming link from: 2. Consuming coefficient relocation1
1. Native integral checked-number value move PPL-SPEC-001639 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.
-
2. Consuming coefficient relocation PPL-SPEC-001640 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.
-
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 PPL-SPEC-000511 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.
-
Incoming link from: 4. Checked named product accumulation1
2. Exact unbounded integer product accumulation PPL-SPEC-000512 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.
-
5. Unbounded integer arithmetic with powers of two PPL-SPEC-000515 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.
-
1. Numerical and geometric foundations PPL-HLR-000001 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.
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.
-
1. C coefficient ownership, conversion and bounds PPL-SPEC-001523 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.
-
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 PPL-SPEC-000045 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.
-
8. Coefficient scaling and truncated division by powers of two PPL-SPEC-000048 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.
-
4. Floating-to-integral range detection and reusable destinations PPL-SPEC-000244 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.
-
5. Integral scalar conversion range outcomes PPL-SPEC-000165 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.
-
6. Rational conversion at and beyond integral endpoints PPL-SPEC-000166 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.
-
2. Coefficient negation and absolute-value assignment PPL-SPEC-000052 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.
-
Incoming link from: 2. Checked named remainder and exact quotient1
3. Coefficient remainder assignment and exact division PPL-SPEC-000053 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.
-
4. Coefficient greatest common divisor and least common multiple PPL-SPEC-000054 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.
-
Incoming link from: 1. Bounded native integer Bezout assignment1
5. Extended integral greatest common divisor PPL-SPEC-000055 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.
-
Incoming link from: 1. Native integer accumulated products and intermediate overflow1
6. Integral product accumulation and subtraction PPL-SPEC-000056 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.
-
8. Reduction of an integral coefficient pair PPL-SPEC-000058 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.
-
5. Bounded integer coefficient policy configuration PPL-SPEC-000555 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.
-
8. Exception classification of numerical result codes PPL-SPEC-000128 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.
-
1. Exact scalar numerator and denominator extraction PPL-SPEC-000919 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.
-
1. Numerical and geometric foundations PPL-HLR-000001 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.
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.
-
1. Rectilinear distance of bounded-difference closed-bound tables PPL-SPEC-001142 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.
-
Incoming link from: 4. Bounded-difference distance normalization, boundaries and workspaces1
2. Euclidean distance of bounded-difference closed-bound tables PPL-SPEC-001143 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.
-
3. Maximum-coordinate distance of bounded-difference closed-bound tables PPL-SPEC-001144 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.
-
4. Bounded-difference distance normalization, boundaries and workspaces PPL-SPEC-001145 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.
-
Incoming link from: 4. Box endpoint-distance domain, workspaces and dispatch1
1. Rectilinear distance between Box endpoint tuples PPL-SPEC-001052 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.
-
Incoming link from: 4. Box endpoint-distance domain, workspaces and dispatch1
2. Euclidean distance between Box endpoint tuples PPL-SPEC-001053 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.
-
Incoming link from: 4. Box endpoint-distance domain, workspaces and dispatch1
3. Maximum-coordinate distance between Box endpoint tuples PPL-SPEC-001054 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.
-
6. Complete checked-wrapper placement construction without a handler PPL-SPEC-001197 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.
-
4. Pointwise upward matrix conversion PPL-SPEC-000754 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.
-
17. Rectilinear distance between bound-entry arrays PPL-SPEC-000767 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.
-
18. Euclidean distance between bound-entry arrays PPL-SPEC-000768 - 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.
-
19. Maximum-coordinate distance between bound-entry arrays PPL-SPEC-000769 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.
-
Incoming links from: 4. Pointwise upward matrix conversion 4. Pointwise upward representation conversion2
7. Pointwise upward conversion of extended-number rows PPL-SPEC-000657 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.
-
1. Finite native floating addition of an accumulated product PPL-SPEC-000521 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.
-
Incoming link from: 4. Checked named product accumulation1
2. Finite native floating subtraction of an accumulated product PPL-SPEC-000522 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.
-
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 PPL-SPEC-000523 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.
-
1. Finite native floating-point addition and subtraction PPL-SPEC-000481 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.
-
2. Finite native floating-point multiplication PPL-SPEC-000482 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.
-
3. Finite native floating-point division by a nonzero value PPL-SPEC-000483 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.
-
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 PPL-SPEC-000484 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.
-
2. Directed conversion to adjacent finite normal floating-point bounds PPL-SPEC-000202 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.
-
3. Directed conversion in the subnormal and underflow range PPL-SPEC-000203 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.
-
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 PPL-SPEC-000205 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.
-
1. Finite native addition and subtraction of a power of two PPL-SPEC-000504 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.
-
Incoming link from: 5. Checked named scaling by powers of two1
2. Finite native multiplication and division by a power of two PPL-SPEC-000505 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.
-
1. Truncated native floating quotient before storage rounding PPL-SPEC-000506 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.
-
4. Rounded nonnegative native residue modulo a power of two PPL-SPEC-000509 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.
-
2. Directed finite floating-to-integral rounding within range PPL-SPEC-000242 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.
-
4. Floating-to-integral range detection and reusable destinations PPL-SPEC-000244 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.
-
3. Directed rational-to-integral conversion within range PPL-SPEC-000163 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.
-
6. Rational conversion at and beyond integral endpoints PPL-SPEC-000166 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.
-
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 PPL-SPEC-000341 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.
-
4. Directed narrowing between finite native floating-point formats PPL-SPEC-000344 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.
-
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 PPL-SPEC-000346 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.
-
2. Directed native integer division and delegated truncation PPL-SPEC-000832 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.
-
Incoming link from: 5. Checked named scaling by powers of two1
2. Directed native integer division by powers of two PPL-SPEC-000838 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.
-
Incoming link from: 6. Checked named nonnegative square root1
1. Directed native integer square-root assignment PPL-SPEC-000840 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.
-
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 PPL-SPEC-000124 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.
-
5. Inversion of a supported rounding bound direction PPL-SPEC-000125 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.
-
6. Mapping a bound direction to the platform FPU encoding PPL-SPEC-000126 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.
-
3. Numeric text input into integral destinations PPL-SPEC-000527 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.
-
4. Numeric text input into supported native floating destinations PPL-SPEC-000528 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.
-
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 PPL-SPEC-001230 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.
-
2. Rectilinear distance of octagonal closed-bound tables PPL-SPEC-001231 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.
-
3. Euclidean distance of octagonal closed-bound tables PPL-SPEC-001232 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.
-
4. Maximum-coordinate distance of octagonal closed-bound tables PPL-SPEC-001233 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.
-
4. Pointwise upward representation conversion PPL-SPEC-000774 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.
-
Incoming link from: 2. Rectilinear distance of octagonal closed-bound tables1
6. Rectilinear distance of physical octagonal entry arrays PPL-SPEC-000796 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.
-
Incoming link from: 3. Euclidean distance of octagonal closed-bound tables1
7. Euclidean distance of physical octagonal entry arrays PPL-SPEC-000797 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.
-
Incoming link from: 4. Maximum-coordinate distance of octagonal closed-bound tables1
8. Maximum-coordinate distance of physical octagonal entry arrays PPL-SPEC-000798 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.
-
9. Distance workspace protocol and admissible overlaps PPL-SPEC-000799 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.
-
3. Weakly relational extended-number policies PPL-SPEC-001641 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.
-
4. Interval and scalar view adapters PPL-SPEC-001642 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.
-
5. Borrowed or converted distance operands PPL-SPEC-001643 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.
-
Incoming link from: 6. Checked named nonnegative square root1
1. Directed and delegated square root of a finite native value PPL-SPEC-000501 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.
-
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 PPL-SPEC-000502 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.
-
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 PPL-SPEC-000503 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.
-
3. Directed unbounded integer division and explicit delegated convention PPL-SPEC-000513 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.
-
5. Unbounded integer arithmetic with powers of two PPL-SPEC-000515 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.
-
2. Directed canonical rational conversion to an unbounded integer PPL-SPEC-000262 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.
-
4. Directed finite native floating-point conversion to mpz storage PPL-SPEC-000264 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.
-
Incoming link from: 7. Raw scalar placement construction and exact assignment1
6. Finite native floating-point placement construction of an unbounded integer PPL-SPEC-001196 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.
-
Incoming link from: 6. Checked named nonnegative square root1
3. Directed unbounded integer square roots PPL-SPEC-000519 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.
-
1. Numerical and geometric foundations PPL-HLR-000001 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.
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.
-
6. Complete checked-wrapper placement construction without a handler PPL-SPEC-001197 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.
-
1. Exact coefficient ratio followed by upward scalar conversion PPL-SPEC-000918 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.
-
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 PPL-SPEC-000324 For a live assignable destination of an admitted raw or checked type in 🔗 1. Native floating-point NaN and infinity predicates, assign_r from Minus_Infinity shall store negative infinity and return V_EQ_MINUS_INFINITY. Assignment from Plus_Infinity shall store positive infinity and return V_EQ_PLUS_INFINITY. Assignment from Not_A_Number shall store a quiet NaN and return V_NAN. These results shall be representable and shall not carry V_UNREPRESENTABLE. The supplied marker shall remain unchanged.
Infinity markers shall admit all four base directions in 🔗 4. Rounding-direction intent, composition and inspection, with or without ROUND_STRICT_RELATION. A NaN marker shall admit ROUND_DOWN, ROUND_UP and ROUND_IGNORE, with or without the strict flag. It shall not require an ordered NaN relation: V_NAN shall retain its empty relation. The _r interface shall return the result without policy-handler dispatch.
Callers shall prevent concurrent destination access while another operation modifies it. Configured-format availability, initialization independence and floating-point state conditions shall follow 🔗 1. Native floating-point NaN and infinity predicates. The value supplied on entry in the destination shall impose no numerical precondition on the replacement. The stored NaN's payload and sign shall be unspecified.
-
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 PPL-SPEC-000201 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.
-
2. Directed conversion to adjacent finite normal floating-point bounds PPL-SPEC-000202 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.
-
3. Directed conversion in the subnormal and underflow range PPL-SPEC-000203 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.
-
4. Delegated and exactness requests for floating-point conversion PPL-SPEC-000204 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.
-
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 PPL-SPEC-000205 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.
-
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 PPL-SPEC-000241 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.
-
2. Directed finite floating-to-integral rounding within range PPL-SPEC-000242 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.
-
3. Delegated floating-to-integral truncation and exactness requests PPL-SPEC-000243 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.
-
4. Floating-to-integral range detection and reusable destinations PPL-SPEC-000244 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.
-
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 PPL-SPEC-000161 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.
-
2. Exact conversion from an unbounded integer to integral storage PPL-SPEC-000162 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.
-
3. Directed rational-to-integral conversion within range PPL-SPEC-000163 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.
-
4. Truncated rational-to-integral conversion and lazy relation requests PPL-SPEC-000164 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.
-
5. Integral scalar conversion range outcomes PPL-SPEC-000165 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.
-
6. Rational conversion at and beyond integral endpoints PPL-SPEC-000166 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.
-
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 PPL-SPEC-000341 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.
-
2. Delegated and exactness native integral conversion to native floating point PPL-SPEC-000342 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.
-
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 PPL-SPEC-000343 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.
-
4. Directed narrowing between finite native floating-point formats PPL-SPEC-000344 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.
-
5. Delegated and exactness native floating-point narrowing PPL-SPEC-000345 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.
-
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 PPL-SPEC-000346 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.
-
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 PPL-SPEC-000124 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.
-
3. Numeric text input into integral destinations PPL-SPEC-000527 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.
-
4. Numeric text input into supported native floating destinations PPL-SPEC-000528 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.
-
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 PPL-SPEC-000091 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.
-
Incoming link from: 1. Exact scalar numerator and denominator extraction1
2. Exact rational assignment of finite native floating-point values PPL-SPEC-000092 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.
-
Incoming link from: 1. Exact scalar numerator and denominator extraction1
8. Rational canonical-form inspection and coefficient component extraction PPL-SPEC-000098 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.
-
1. Exact scalar numerator and denominator extraction PPL-SPEC-000919 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.
-
3. Weakly relational extended-number policies PPL-SPEC-001641 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.
-
5. Borrowed or converted distance operands PPL-SPEC-001643 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.
-
1. Exact native integral and unbounded integer assignment to mpz storage PPL-SPEC-000261 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.
-
2. Directed canonical rational conversion to an unbounded integer PPL-SPEC-000262 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.
-
Incoming link from: 3. Numeric text input into integral destinations1
3. Delegated and exactness rational conversion to an unbounded integer PPL-SPEC-000263 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.
-
4. Directed finite native floating-point conversion to mpz storage PPL-SPEC-000264 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.
-
5. Delegated finite floating-point conversion and exactness into mpz storage PPL-SPEC-000265 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.
-
Incoming link from: 7. Raw scalar placement construction and exact assignment1
6. Finite native floating-point placement construction of an unbounded integer PPL-SPEC-001196 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.
-
1. Numerical and geometric foundations PPL-HLR-000001 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.
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.
-
4. Coefficient quotient and remainder with truncation toward zero PPL-SPEC-000044 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.
-
8. Coefficient scaling and truncated division by powers of two PPL-SPEC-000048 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.
-
Incoming link from: 2. Checked named remainder and exact quotient1
3. Coefficient remainder assignment and exact division PPL-SPEC-000053 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.
-
2. Directed native integer division and delegated truncation PPL-SPEC-000832 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.
-
3. Exact native truncated quotient and remainder PPL-SPEC-000833 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.
-
Incoming link from: 5. Checked named scaling by powers of two1
2. Directed native integer division by powers of two PPL-SPEC-000838 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.
-
Incoming link from: 4. Outward endpoint residues modulo powers of two1
3. Centered and nonnegative native integer dyadic residues PPL-SPEC-000839 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.
-
Incoming links from: 1. Same-storage checked compound arithmetic 2. Checked named remainder and exact quotient2
5. Truncated rational quotient and signed rational remainder PPL-SPEC-000095 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.
-
3. Directed unbounded integer division and explicit delegated convention PPL-SPEC-000513 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.
-
Incoming links from: 1. Same-storage checked compound arithmetic 2. Checked named remainder and exact quotient2
4. Exact truncated unbounded integer quotient and remainder PPL-SPEC-000514 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.
-
5. Unbounded integer arithmetic with powers of two PPL-SPEC-000515 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.
-
Incoming link from: 4. Outward endpoint residues modulo powers of two1
6. Exact centered and nonnegative unbounded integer residues PPL-SPEC-000516 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.
-
1. Numerical and geometric foundations PPL-HLR-000001 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.
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.
-
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 PPL-SPEC-000093 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.
-
Incoming link from: 4. Checked named product accumulation1
7. Exact rational product accumulation and subtraction PPL-SPEC-000097 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.