C++ interval arithmetic with included infinity points
|
Type
|
Level
|
MID
|
UID
|
REFS
|
Title
|
Statement
|
Rationale
|
Comment
|
BIBLIOGRAPHY
|
STATUS
|
COMPONENT
|
APPLICABILITY
|
VERIFICATION_METHODS
|
VERIFICATION_CRITERIA
|
SOURCE
|
LANGUAGE
|
VISIBILITY
|
INTERFACE
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
SW_SPEC
|
1 |
|
|
|
For extended-real entry sets X and Y, add_assign(x,y) and sub_assign(x,y) shall enclose the hull of all their defined extended-real sums and differences. Opposite infinities shall have no sum and equal infinities no difference; these undefined pairs shall contribute no value. With exact endpoint operations and supported membership the enclosure shall be exact. If there is no defined pair, the result shall be empty. A finite nonempty interval combined with an included infinity singleton shall give the corresponding signed infinity, reversing the right infinity for subtraction. Equal-sign infinity singleton sums and opposite-sign singleton differences shall retain the defined infinity. For rays, a finite extremum shall be attained exactly when its required source extrema are attained; a same-sign infinite sum shall be included if either operand can attain that infinity. Opposite outward rays shall retain every defined finite sum, independently of whether their infinite endpoints are included. Intervals shall be initialized and valid over a common extended-real carrier whose numerical and information policies admit both actual infinity points and their exclusion. An excluded infinite endpoint shall denote an unbounded finite extent, not an included point. NaN shall not be an interval element. The receiving policy shall admit empty results and the required endpoint membership. Scalar kernels and every finite intermediate shall meet their range, policy, resource, canonical-rational, synchronization, temporary-storage and caller-owned FPU prerequisites. An inexact endpoint operation or an unsupported membership distinction may enlarge an image but shall not exclude defined results. The receiver may alias either interval operand, using both entry sets; distinct operands shall remain unchanged. Failures shall retain the scalar operation's guarantees without a universal rollback promise. Returned I_Result claims shall retain 🔗 1. Interval result possibilities and status-flag set operations. Ordinary-real intervals shall retain 🔗 2. Ordinary interval addition and subtraction, 🔗 3. Ordinary interval multiplication and 🔗 4. Ordinary interval division and zero-divisor abstraction. |
Included infinity points affect defined arithmetic pairs and endpoint attainment differently from excluded unbounded finite limits. |
|
|
|
|
|
Check finite/infinity singleton permutations, same/opposite infinity pairs, both open/closed finite ray endpoints, included/excluded infinite endpoints, opposite rays and each output alias. Derive expected sets from explicit extended-real pairs rather than applying ordinary-real contracts to infinity. |
src/Interval_templates.hh; src/Interval_inlines.hh; tests/intervalinfinityarithmetic1.cc. |
|
|
Public header: <ppl.hh>; Interval::add_assign and Interval::sub_assign for compatible extended-real interval operands. |
||
|
SW_SPEC
|
2 |
|
|
Incoming link from:
3. Degenerate and singular extended interval products and quotients
1 |
For two nonempty extended-real intervals each wholly strictly positive or wholly strictly negative, mul_assign(x,y) and div_assign(x,y) shall enclose the interval hull of all defined extended-real products or quotients. A zero endpoint may be approached but shall not be included under this sign-stable contract. Infinity divided by infinity shall be undefined and contribute no value; finite values divided by an included infinity shall contribute zero. With exact admitted endpoint operations and supported membership, the resulting enclosure shall be exact for these sign-stable operands. The signs shall select the mathematical orientation of the result. An infinite product shall be included when an applicable infinite factor is included and a nonzero partner exists. A quotient's zero endpoint shall be included when a finite numerator can be divided by an included infinity; an infinite quotient shall be included when an included infinite numerator has a finite nonzero denominator. Endpoint limits alone shall not establish attainment. These rules shall allow zero and infinity inclusion to vary independently in a ray quotient. Intervals shall be initialized and valid over a common extended-real carrier whose numerical and information policies admit both actual infinity points and their exclusion. An excluded infinite endpoint shall denote an unbounded finite extent, not an included point. NaN shall not be an interval element. The receiving policy shall admit empty results and the required endpoint membership. Scalar kernels and every finite intermediate shall meet their range, policy, resource, canonical-rational, synchronization, temporary-storage and caller-owned FPU prerequisites. An inexact endpoint operation or an unsupported membership distinction may enlarge an image but shall not exclude defined results. The receiver may alias either interval operand, using both entry sets; distinct operands shall remain unchanged. Failures shall retain the scalar operation's guarantees without a universal rollback promise. Returned I_Result claims shall retain 🔗 1. Interval result possibilities and status-flag set operations. Ordinary-real intervals shall retain 🔗 2. Ordinary interval addition and subtraction, 🔗 3. Ordinary interval multiplication and 🔗 4. Ordinary interval division and zero-divisor abstraction. |
Included infinity points affect defined arithmetic pairs and endpoint attainment differently from excluded unbounded finite limits. |
|
|
|
|
|
Cross positive/negative rays with bounded nonzero intervals and other rays. Vary finite endpoint openness and infinite endpoint inclusion independently. Compare literal expected sign-oriented sets, zero/infinity attainment and unchanged separate inputs. Exercise exact rational endpoints and admitted receiver aliases; retain zero-crossing divisor tests under their separate ordinary-interval abstraction contract. |
src/Interval_templates.hh; src/Interval_inlines.hh; tests/intervalinfinityarithmetic1.cc. |
|
|
Public header: <ppl.hh>; Interval::mul_assign and Interval::div_assign for compatible, strictly one-sign extended intervals. |
||
|
SW_SPEC
|
3 |
|
|
|
For initialized, valid intervals over a common extended-real carrier, mul_assign(x,y) and div_assign(x,y) shall enclose every defined extended-real product or quotient of their entry sets. NaN shall not be an interval element. Zero times infinity, infinity divided by infinity and division by zero shall be undefined and shall contribute no value. An empty operand shall yield an empty result. With exact admitted endpoint operations and supported membership, an infinity singleton multiplied by a finite interval shall yield empty if that interval contains only zero, the appropriately signed infinity if its nonzero elements have one sign, and the interval hull of both infinity points if both signs occur. An included zero shall contribute no extra product. Products of infinity singletons shall retain the product sign. An infinity singleton divided by a finite interval shall have the analogous sign-dependent image of its nonzero denominator elements. Dividing an infinity singleton by another infinity singleton or by a zero singleton shall yield empty. Dividing a nonempty finite interval by an included infinity singleton shall yield the zero singleton. For a finite strictly positive or strictly negative numerator interval and a one-sided finite denominator interval approaching zero, division shall enclose the correspondingly signed unbounded ray. An infinite bound that arises only as a limit shall be excluded when the receiving policy can express that distinction. For a denominator with both negative and positive finite elements, a conservative universe result shall be permitted, including when the exact quotient has disconnected pieces. When a nonempty finite numerator is divided by a denominator containing zero and values of both signs, the returned I_Result shall include I_SINGULARITIES under 🔗 1. Interval result possibilities and status-flag set operations. A singularity indication shall not assert that an undefined pair has a value. The source and receiving policies shall admit the required actual infinity points, empty results and finite scalar operations. An excluded infinite endpoint shall denote an unbounded finite extent. Numerical intermediates, resources, canonical-rational values, synchronization, shared temporaries and caller-owned FPU state shall meet the scalar kernels' prerequisites. Inexact arithmetic or an unsupported membership distinction may enlarge the result but shall not exclude defined values. Receiver aliases shall use both entry sets; distinct operands shall remain unchanged. Scalar failures shall retain their own guarantees without a universal rollback promise. Sign-stable cases shall retain 🔗 2. Sign-stable extended interval products and quotients, and ordinary-real interval division shall retain 🔗 4. Ordinary interval division and zero-divisor abstraction. |
Infinity singletons, zero operands and zero-crossing divisors are outside the strictly one-sign operand domain and need explicit defined-pair and conservative-enclosure rules. |
|
|
|
|
|
Compare literal infinity, empty, zero, ray and universe results for both infinity signs and positive, negative, zero, mixed-sign and empty partners. Check finite division by an infinity singleton, infinity divided by infinity, one-sided zero limits and zero-crossing divisors. Repeat with open and closed endpoint policies and available native floating types. Check direct and supported aliased outputs, unchanged separate sources and singularity flags where specified. |
src/Interval_inlines.hh; src/Interval_templates.hh; tests/Box/intervalcontracts1.cc. |
|
|
Public header: <ppl.hh>; Interval::mul_assign and Interval::div_assign for policies admitting actual infinity points. |