Parma Polyhedra Library requirements
Internal numerical and common scalar helpers
  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 4. Explicit numerical operation contracts PPL-LLR-000442

    Each supported numerical operation shall have an explicit contract identifying its concrete meaning, the conditions of its numerical guarantees, and the meaning of its exact, approximate, inconclusive and failure outcomes, as applicable. The contract shall identify its applicable domain, numerical profile and interface contexts; restrictions on availability or precision shall be consistent with the required facility and selected configuration.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

PPL-SPEC-001630
1. Native unsigned bit positions PPL-SPEC-001630

For a nonzero value of unsigned int, unsigned long or unsigned long long with w value bits, clz shall return w − 1 − ⌊log2x⌋; ctz shall return the greatest k such that 2k divides x. Zero shall be outside their admitted input domain. msb_position(x) shall return the zero-based position ⌊log2x⌋ of a nonzero unsigned long long. The Implementation::first_one and Implementation::last_one overloads for the same three unsigned types shall return the least and greatest set-bit indices, respectively. All functions shall preserve their input and require no library initialization.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 4. Explicit numerical operation contracts PPL-LLR-000442

    Each supported numerical operation shall have an explicit contract identifying its concrete meaning, the conditions of its numerical guarantees, and the meaning of its exact, approximate, inconclusive and failure outcomes, as applicable. The contract shall identify its applicable domain, numerical profile and interface contexts; restrictions on availability or precision shall be consistent with the required facility and selected configuration.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

PPL-SPEC-001631
2. Dimension arithmetic, capacity and common access helpers PPL-SPEC-001631

hash_code_from_dimension(d) shall return d − 231⌊d ⁄ 231⌋ as int32_t. least_significant_one_mask(d) shall return zero for zero, and otherwise the single-bit mask of the least significant one in d.

For 0 ≤ n ≤ m, compute_capacity(n,m) shall return 2(n + 1) when n < ⌊m ⁄ 2⌋, and m otherwise. Its result shall be representable and lie in [n, m].

For a live random-access container, nth_iter(c,n) shall return c.begin()+n with the corresponding mutable or const iterator type. The offset shall be representable in the container's difference_type and shall designate an element or the past-the-end position. No element shall change. is_space(c) shall apply the active C locale's whitespace classification to static_cast<unsigned char>(c); every char value shall be admitted, including negative values on signed-char targets. These helpers shall require no library initialization.

PPL-SPEC-001632
3. Raw scalar memory accounting PPL-SPEC-001632

For a live native scalar T, external_memory_in_bytes shall return zero and total_memory_in_bytes shall return sizeof(T). For a live mpz_class, external memory shall equal its allocated limb count multiplied by PPL_SIZEOF_MP_LIMB_T. For a live mpq_class, it shall equal the sum of its numerator's and denominator's external memory. Total GMP scalar memory shall add the corresponding scalar object's sizeof. These functions shall preserve values and allocations. The reported sum and products shall be representable in memory_size_type. They shall account for the scalar's owned storage, without measuring allocator bookkeeping or shared library state. The checked-wrapper forwarding rule shall remain 🔗 5. Checked scalar memory-size inspection.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 4. Explicit numerical operation contracts PPL-LLR-000442

    Each supported numerical operation shall have an explicit contract identifying its concrete meaning, the conditions of its numerical guarantees, and the meaning of its exact, approximate, inconclusive and failure outcomes, as applicable. The contract shall identify its applicable domain, numerical profile and interface contexts; restrictions on availability or precision shall be consistent with the required facility and selected configuration.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

PPL-SPEC-001633
4. Assignment, swap and invariant dispatch PPL-SPEC-001633

For live admitted T objects, assign_or_swap(to,from) shall select exactly one strategy at compile time. If Has_Assign_Or_Swap<T>::value is true, it shall call to.assign_or_swap(from) once. Otherwise, if Slow_Copy<T>::value is false, it shall perform to=from once. Otherwise it shall perform one unqualified swap(to,from) with std::swap available. The selected operation shall determine the values, source modification, alias admissibility and exception guarantees; its exceptions shall propagate. GMP integer and rational swap adapters shall exchange the owned values, preserving independent valid storage. A slow-copy type used with the generic PPL swap shall require an applicable specialization; the unspecialized generic form shall fail to instantiate.

For T with a detected bool OK() const member, f_OK(t) shall return t.OK(). Its native scalar and GMP scalar overloads shall return true. Calling f_OK shall retain the selected object's invariant-query prerequisites and exception behavior.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 4. Explicit numerical operation contracts PPL-LLR-000442

    Each supported numerical operation shall have an explicit contract identifying its concrete meaning, the conditions of its numerical guarantees, and the meaning of its exact, approximate, inconclusive and failure outcomes, as applicable. The contract shall identify its applicable domain, numerical profile and interface contexts; restrictions on availability or precision shall be consistent with the required facility and selected configuration.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

PPL-SPEC-001634
5. Representation-selector ASCII records PPL-SPEC-001634

For an admitted Representation equal to DENSE or SPARSE, ascii_dump shall insert exactly DENSE or SPARSE, respectively. ascii_load shall extract one whitespace-delimited string and accept exactly either of those case-sensitive tokens, assigning the corresponding selector and returning true. A normally failed extraction or any other token shall return false and preserve the destination selector. A complete accepted record shall leave following tokens available. Stream exceptions shall propagate according to the stream's exception mask; output shall preserve the selector. Neither function shall require library initialization.

PPL-SPEC-001635
6. Exact comparison of short sums through directed filters PPL-SPEC-001635

The internal Implementation short-sum helpers shall operate on two or three addends per list. Each pointer shall designate a live admitted scalar. Original left addends shall be finite; right addends may additionally be positive infinity. NaN and negative infinity shall be outside the admitted domain. The scalar policy and arithmetic shall supply sound upward/downward bounds, valid overflow outcomes, and exact rational conversion of each finite original addend. Required rounding setup, resources and synchronization shall follow those scalar operations.

checked_sum_assign<Count> shall evaluate the first two addends and then, for three terms, add the third, using the requested direction. It shall return true exactly when every addition reports V_EQ; false shall not by itself assert that the final mathematical sum is inexact. Its output shall be independent of all input addend storage.

checked_sum_has_infinite_right shall return true exactly when an original right addend is positive infinity. checked_sum_less shall return exactly ∑iLi < ∑jRj, including finite sums outside the bounded scalar range. A positive-infinite original right operand shall make this predicate true before sum arithmetic is attempted. A finite rounded overflow shall not be mistaken for an original infinite operand.

The cached-left overload shall receive the same upward left sum and exactness flag produced by checked_sum_assign for those original left addends. checked_finite_sum_less shall additionally require all right addends finite. Directed bounds may decide the comparison only when they establish its truth or falsity. An unresolved comparison shall use exact rational arithmetic on the original finite addends. No input addend shall change.

7. Raw scalar placement construction and exact assignment PPL-SPEC-001636

The internal Checked::construct dispatch shall receive suitably aligned storage for one complete destination scalar object, with no live object requiring destruction there. For finite same-type, same-policy input, it shall copy-construct an independent scalar and return V_EQ. The generic different-type path shall first default-construct the destination, then apply the corresponding checked assignment with the requested rounding direction, returning that assignment's Result without invoking a policy handler. Admitted native/GMP exact constructor specializations shall directly construct the exact value and return V_EQ. The floating-to-GMP-integer constructor shall retain 🔗 6. Finite native floating-point placement construction of an unbounded integer; supported floating-to-rational construction shall preserve the exact finite floating value. Special-value routing shall follow 🔗 1. Typed special construction in native scalar storage and the destination policy's capabilities.

The internal assign_exact adapter shall assign the admitted exactly representable source to a live destination and return V_EQ without a handler. It shall not perform rounding. Source values shall be preserved and owned GMP values shall be independent.

Underlying constructor, assignment and resource exceptions shall propagate. A destination whose construction itself throws shall not be used or destroyed as a completed object; if assignment throws after default construction, that underlying scalar shall remain live with the assignment's failure guarantees. These raw construction paths shall not be required by the ordinary converting Checked_Number constructors of 🔗 2. Finite checked scalar converting construction and assignment.

PPL-SPEC-001637
8. Native floating storage, neighbors and precision barriers PPL-SPEC-001637

For a configured supported native floating type T, Float<T>(v) shall retain the native value and expose its corresponding binary descriptor; value() shall return that stored native value. Representation access shall use standard-defined object-representation copies, without reading an inactive union member. Native padding shall not be interpreted as an integer field; x87 conversions shall preserve the 64-bit significand and 16-bit sign/exponent, ignoring native padding and the descriptor's high padding bits. The binary descriptor shall remain the active union member, including after default construction. Default construction shall leave the raw storage unspecified until the caller establishes a valid value or complete binary encoding. Reads shall require such initialization and an admitted encoding of the configured native format.

Checked::pred_float(v) shall replace an admitted finite value or positive infinity with its immediate predecessor in that native format. succ_float(v) shall replace a finite value or negative infinity with its immediate successor. NaN and the opposite unbounded endpoint shall be outside the corresponding admitted input domain. Predecessor of either zero shall be the smallest negative subnormal; successor of either zero shall be the smallest positive subnormal. Approaching zero from the positive or negative side shall retain the corresponding zero sign. No rounding mode change shall be required.

For supported native floating Raw, materialize_native_value shall return a value materialized at that native format under the active rounding direction when the configured evaluation format has excess precision or range; otherwise it shall return the input value. limit_precision for float and double shall apply PPL_CC_FLUSH: on GNU-compatible compilers this shall force a memory observation of the argument; on the portable fallback it shall merely mark the argument used. The long double overload shall do nothing. None of these helpers shall change the rounding direction. round_to_integer shall return the integral native floating value selected by the active hardware rounding direction. Its input shall be finite, and hardware setup and floating exceptions shall follow that native operation.

PPL-SPEC-001638
9. Configured FPU backend control and status PPL-SPEC-001638

On an available configured backend, fpu_initialize_control_functions shall establish that its control operations are usable. The C99 backend shall probe downward and upward selection and restore its original direction on successful return; a failed selection shall throw std::logic_error. Initialization shall not promise restoration after a failed probe.

fpu_get_rounding_direction shall report the selected hardware direction; fpu_set_rounding_direction shall select an admitted platform encoding. fpu_save_rounding_direction shall select its argument and return a token accepted by fpu_restore_rounding_direction. On C99 and SPARC backends, restoration shall recover the preceding direction. The optimized IA32 pair shall require the default upward entry state and shall restore that default; its token shall not encode an arbitrary preceding environment. No backend shall promise to restore the entire floating environment through this pair.

fpu_check_inexact shall return zero for a definitely clear flag, one for a definitely set flag, or minus one when flag observation is unavailable, without clearing an observed flag. fpu_reset_inexact shall clear the observable inexact state. The IA32 reset shall require default upward rounding and may clear other arithmetic exception flags. C99/SPARC reset shall preserve other flags and the selected direction.

Where the IA32 raw-register helpers are available, control/status reads shall return the corresponding x87 control or status word, control writes shall load the admitted x87 word, fpu_clear_status(bits) shall clear selected status bits, and fpu_clear_exceptions shall clear the x87 exception state. SSE control reads/writes shall access MXCSR when that unit is available. Inputs shall be valid hardware control words and callers shall own access to the current thread's environment; trap enables and encodings shall be valid for every operation attempted. These raw operations shall not affect another thread's state. The no-control backend's control/status functions shall throw std::logic_error rather than report successful control.

PPL-SPEC-001650
10. Native finite affine interval congruence classification PPL-SPEC-001650

native_interval_relation<Halve>() shall require finite native bounds, a positive magnitude a, a positive modulus m and exact unbounded native arithmetic. With h = 2 when Halve is true and h = 1 otherwise, its admitted affine interval shall be nonempty: L = c − a neg_lower ⁄ h ≤ U = c + a upper ⁄ h, where c is expr.inhomogeneous_term(). The selected halving operation shall be exact.

The result shall be disjoint exactly when [L, U]∩mℤ is empty. It shall be included and saturating exactly when L = U ∈ mℤ. Otherwise it shall strictly intersect. Expression, magnitude, modulus and supplied bounds shall be preserved. Supported numerical and allocation failures may propagate; temporaries shall release their owned resources. Numerical initialization, lifetime and synchronization prerequisites shall follow 🔗 1. Bounded-difference values, numerical profiles and valid use and 🔗 1. Octagonal values, numerical profiles and valid use for the calling domain.

  • 1. Exact integral coefficient calculations PPL-LLR-000001

    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.

    • PPL-HLR-000001
      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-SPEC-001663
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.

PPL-SPEC-001708
12. Certified finite scalar embeddings PPL-SPEC-001708

For the default raw scalar families admitted by 🔗 1. Finite checked scalar storage and copying, Checked::Safe_Conversion<To, From>::value shall be a constant-expression Boolean certificate. A true value shall certify that every admitted finite mathematical value of From is exactly representable as a finite To value. Native floating values shall mean their exact stored binary values; finite rational storage shall be canonical. Unbounded storage shall require sufficient resources. The certificate shall concern finite values, not the policy-dependent handling of infinities or NaNs.

Identical types shall have a true certificate, including identical nonnumeric types; the numerical guarantee shall concern admitted numerical types only. The unspecialized different-type case shall be false. The supplied numerical specializations may be conservative: false shall mean that no certificate is provided, rather than that every conversion loses information. This trait shall neither perform conversion nor admit additional scalar types. Its use shall require no runtime inspection, allocation, rounding change or policy handler. Consumers shall retain their own operand and operation prerequisites, including 🔗 1. Exact scalar sign and ordering, 🔗 2. Mixed finite floating and exact scalar ordering and 🔗 3. Best bounded-difference enclosure of Cartesian boxes.

PPL-SPEC-001709
13. Integral constant representability and type selection PPL-SPEC-001709

With its default third template argument, Fit<T, v> shall report true exactly when the long long value v is representable in the unqualified native integer type T admitted by C_Integer_Type. This includes plain char with its configured signedness. Other types, including bool, GMP classes, cv-qualified or reference types, and a non-void third argument, shall use the false primary template.

Constant<v, prefer_signed> shall expose value_type and value through the standard std::integral_constant interface. Its value shall be exactly v. It shall select the first representable rank in this order: signed char/unsigned char, short/unsigned short, int/unsigned int, long/unsigned long, then long long. Within each of the first four ranks it shall select the preferred signedness when both candidates fit, otherwise the candidate that fits. The default preference shall be signed. The final fallback shall always be signed long long, including when unsigned is preferred. Plain char, bool and unsigned long long shall not be selection candidates.

C_Integer shall provide the predecessor types for this rank traversal. Constant_ shall implement the recursion; nondefault implementation parameters shall not form part of this selection interface. The traits shall be usable in constant expressions and require no runtime initialization, allocation, conversion, policy handler or FPU rounding control.

PPL-SPEC-001725
14. Configured native gradual-underflow environment probe PPL-SPEC-001725

For each native floating type admitted by the configured PPL support flags, the probe shall check gradual underflow when numeric_limits reports a binary format with subnormals. Exact halving and restoration of the least positive normal shall preserve positive and negative subnormal values. Dividing the least positive/negative subnormal by the positive least subnormal shall yield positive/negative one, thereby checking that subnormal inputs are not flushed. Volatile loads and stores shall force the intended native runtime operations. Other formats and unselected types shall be skipped without claiming that the probe ran for them. Failure shall identify the type and failed condition. The C entry point shall return the C++ probe's success as 0, or failure as 1. This is a check of the calling process's numerical environment, not a promise to configure FPU rounding, exception masks or universal subnormal support.