C++ finite native floating product accumulation
|
Type
|
Level
|
MID
|
UID
|
REFS
|
Title
|
Statement
|
Rationale
|
Comment
|
BIBLIOGRAPHY
|
STATUS
|
COMPONENT
|
APPLICABILITY
|
VERIFICATION_METHODS
|
VERIFICATION_CRITERIA
|
SOURCE
|
LANGUAGE
|
VISIBILITY
|
INTERFACE
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
SW_SPEC
|
1 |
|
|
|
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. |
Product accumulation needs entry-accumulator semantics and a bound on the complete real expression even when an available native implementation uses more than one rounding. |
|
|
|
|
|
Use exact dyadic rational expression oracles across source signs, cancellation, signed zeros, precision limits and subnormals. Cross all raw/checked forms and every accumulator/source alias whose entry values coincide. Check conservative directions, configured precision, statuses, source preservation and hardware state. |
src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingaccumulationspec1.cc. |
|
|
Public header: <ppl.hh>; effective template instantiations for admitted same-format To, Left and Right types: Result add_mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir); |
||
|
SW_SPEC
|
2 |
|
|
Incoming link from:
4. Checked named product accumulation
1 |
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. |
Subtracting a product must reverse the product sign before applying the directed bound to the full accumulated expression. |
|
|
|
|
|
Check independent exact expressions with both product signs, cancellation, zeros, subnormal and precision-boundary inputs. Include downward cases that distinguish negation after rounding from changing the fused operation, all admitted aliases, raw/checked forms and hardware preservation. |
src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingaccumulationspec1.cc. |
|
|
Public header: <ppl.hh>; effective template instantiations for admitted same-format To, Left and Right types: Result sub_mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir); |
||
|
SW_SPEC
|
3 |
|
|
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 product
6 |
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. |
Native multiply/add fusion, intermediate evaluation width and product storage are configuration dependent. Specifying their exact rounding paths preserves the permitted native implementation while excluding arbitrary conservative answers. Monotonicity of addition and directed rounding preserves the requested bound through each arithmetic and storage step; intermediate inexactness alone does not establish a strict comparison in every delegated mode. |
|
|
|
|
|
Check exact dyadic complete-expression and format-rounding oracles under fused and supported nonfused paths. Establish evaluation format and control precision independently of the observed result. Cover both retained and storage-narrowed products, directed bounds, caller-mode delegation, nearest-even double-rounding separators, signed zero at every step, subnormal/overflow boundaries, exactness preconditions and truth of every returned relation. Include cancellation separating the extended, fused-F and staged-F results, and reject conservative values outside the specified paths. Capture native oracle inputs and outputs at their storage width. Assess all raw/checked instantiations, aliases and hardware preservation. |
src/checked_float_inlines.hh; src/Checked_Number_defs.hh and src/Checked_Number_inlines.hh; tests/floatingaccumulationspec1.cc. |
|
|
Public header: <ppl.hh>; effective template instantiations for admitted same-format To, Left and Right types: Result add_mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir); Result sub_mul_assign_r(To& to, const Left& x, const Right& y, Rounding_Dir dir); |