22 #ifndef LSST_AFW_MATH_POLYNOMIALS_SafeSum_h_INCLUDED 23 #define LSST_AFW_MATH_POLYNOMIALS_SafeSum_h_INCLUDED 27 namespace lsst {
namespace geom {
namespace polynomials {
65 explicit SafeSum(T initial=static_cast<T>(0)) noexcept :
67 _correction(static_cast<T>(0))
72 _correction =
static_cast<T
>(0);
81 _correction += (_sum - t) + value;
83 _correction += (value - t) + _sum;
93 explicit operator T() const noexcept {
94 return _sum + _correction;
104 #endif // !LSST_AFW_MATH_POLYNOMIALS_SafeSum_h_INCLUDED Angle abs(Angle const &a)
Summation using regular floating-point addition.
Extent< double, N > & operator+=(Extent< double, N > &lhs, Extent< int, N > const &rhs) noexcept
A numerically stable summation algorithm for floating-point numbers.
SafeSum(T initial=static_cast< T >(0)) noexcept
SafeSum & operator=(T value) noexcept
SumMode
Enum used to control how to sum polynomial terms.
A base class for image defects.
SafeSum & operator-=(T value) noexcept
SafeSum & operator+=(T value) noexcept
Compensated summation using SafeSum. Involves ~4x as many floating point operations.