|
Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
|
TrackedExact provides perfect error tracking for IEEE-like types using two_sum/two_prod decomposition. More...
#include <tracked_exact.hpp>
Public Types | |
| using | value_type = T |
Public Member Functions | |
| constexpr | TrackedExact () noexcept |
| Default constructor: zero value with no error. | |
| constexpr | TrackedExact (T v) noexcept |
| Construct from a value (no error initially). | |
| constexpr | TrackedExact (T v, double err, uint64_t ops, uint64_t absorb=0) noexcept |
| Construct with explicit error, op count, and absorptions (internal use). | |
| constexpr | TrackedExact (const TrackedExact &) noexcept=default |
| constexpr | TrackedExact (TrackedExact &&) noexcept=default |
| constexpr TrackedExact & | operator= (const TrackedExact &) noexcept=default |
| constexpr TrackedExact & | operator= (TrackedExact &&) noexcept=default |
| constexpr TrackedExact & | operator= (T v) noexcept |
| Assign from raw value (resets error and absorptions). | |
| constexpr T | value () const noexcept |
| Get the computed value. | |
| constexpr double | error () const noexcept |
| Get cumulative absolute error. | |
| constexpr uint64_t | operations () const noexcept |
| Get operation count. | |
| constexpr uint64_t | absorptions () const noexcept |
| Get absorption count. | |
| constexpr bool | had_absorption () const noexcept |
| Did any absorption occur? | |
| constexpr | operator T () const noexcept |
| Implicit conversion to underlying type. | |
| double | relative_error () const noexcept |
| Relative error (error / |value|). | |
| double | valid_bits () const noexcept |
| Estimate of valid bits remaining -log2(relative_error) gives bits of accuracy, capped at type precision. | |
| double | ulps_error () const noexcept |
| ULPs of error. | |
| bool | is_exact () const noexcept |
| Is the result exact (no accumulated error)? | |
| TrackedExact | operator+ (const TrackedExact &rhs) const |
| Addition with exact error tracking and absorption detection. | |
| TrackedExact | operator+ (T rhs) const |
| Addition with scalar. | |
| TrackedExact | operator- (const TrackedExact &rhs) const |
| Subtraction with exact error tracking and absorption detection. | |
| TrackedExact | operator- (T rhs) const |
| Subtraction with scalar. | |
| TrackedExact | operator- () const |
| Unary minus (preserves absorption count). | |
| TrackedExact | operator* (const TrackedExact &rhs) const |
| Multiplication with exact error tracking Error propagation: (a + ea) * (b + eb) = ab + a*eb + b*ea + ea*eb We track: |a|*err(b) + |b|*err(a) + |rounding_error| Note: Multiplication doesn't cause absorption, but propagates absorption count. | |
| TrackedExact | operator* (T rhs) const |
| Multiplication with scalar. | |
| TrackedExact | operator/ (const TrackedExact &rhs) const |
| Division with exact error tracking Division is computed as a * (1/b), tracking the error in reciprocal Note: Division doesn't cause absorption, but propagates absorption count. | |
| TrackedExact | operator/ (T rhs) const |
| Division with scalar. | |
| TrackedExact & | operator+= (const TrackedExact &rhs) |
| TrackedExact & | operator+= (T rhs) |
| TrackedExact & | operator-= (const TrackedExact &rhs) |
| TrackedExact & | operator-= (T rhs) |
| TrackedExact & | operator*= (const TrackedExact &rhs) |
| TrackedExact & | operator*= (T rhs) |
| TrackedExact & | operator/= (const TrackedExact &rhs) |
| TrackedExact & | operator/= (T rhs) |
| bool | operator== (const TrackedExact &rhs) const noexcept |
| bool | operator!= (const TrackedExact &rhs) const noexcept |
| bool | operator< (const TrackedExact &rhs) const noexcept |
| bool | operator<= (const TrackedExact &rhs) const noexcept |
| bool | operator> (const TrackedExact &rhs) const noexcept |
| bool | operator>= (const TrackedExact &rhs) const noexcept |
| TrackedExact | sqr () const |
| Square with optimized error tracking (propagates absorptions). | |
| void | report (std::ostream &os) const |
| Output a detailed report of the tracked value. | |
TrackedExact provides perfect error tracking for IEEE-like types using two_sum/two_prod decomposition.
| using sw::universal::TrackedExact< T >::value_type = T |
|
inlineconstexprnoexcept |
Default constructor: zero value with no error.
|
inlineconstexprnoexcept |
Construct from a value (no error initially).
|
inlineconstexprnoexcept |
Construct with explicit error, op count, and absorptions (internal use).
|
constexprdefaultnoexcept |
|
constexprdefaultnoexcept |
|
inlineconstexprnoexcept |
Get absorption count.
|
inlineconstexprnoexcept |
Get cumulative absolute error.
|
inlineconstexprnoexcept |
Did any absorption occur?
|
inlinenoexcept |
Is the result exact (no accumulated error)?
|
inlineconstexprnoexcept |
Get operation count.
|
inlineconstexprnoexcept |
Implicit conversion to underlying type.
|
inlinenoexcept |
|
inline |
Multiplication with exact error tracking Error propagation: (a + ea) * (b + eb) = ab + a*eb + b*ea + ea*eb We track: |a|*err(b) + |b|*err(a) + |rounding_error| Note: Multiplication doesn't cause absorption, but propagates absorption count.
|
inline |
Multiplication with scalar.
|
inline |
|
inline |
|
inline |
Addition with exact error tracking and absorption detection.
|
inline |
Addition with scalar.
|
inline |
|
inline |
|
inline |
Unary minus (preserves absorption count).
|
inline |
Subtraction with exact error tracking and absorption detection.
|
inline |
Subtraction with scalar.
|
inline |
|
inline |
|
inline |
Division with exact error tracking Division is computed as a * (1/b), tracking the error in reciprocal Note: Division doesn't cause absorption, but propagates absorption count.
|
inline |
Division with scalar.
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
constexprdefaultnoexcept |
|
inlineconstexprnoexcept |
Assign from raw value (resets error and absorptions).
|
constexprdefaultnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Relative error (error / |value|).
|
inline |
Output a detailed report of the tracked value.
|
inline |
Square with optimized error tracking (propagates absorptions).
|
inlinenoexcept |
ULPs of error.
|
inlinenoexcept |
Estimate of valid bits remaining -log2(relative_error) gives bits of accuracy, capped at type precision.
|
inlineconstexprnoexcept |
Get the computed value.