16 #ifndef _SOPLEX_STABLE_SUM_H_ 17 #define _SOPLEX_STABLE_SUM_H_ 18 #include <type_traits> 28 typename std::remove_const<T>::type
sum;
44 operator typename std::remove_const<T>::type()
const 56 #ifdef CHECK_STABLESUM 66 #if defined(_MSC_VER) || defined(__INTEL_COMPILER) 67 #pragma float_control( precise, on ) 69 #ifdef CHECK_STABLESUM 72 double t = sum + input;
74 double y = (sum - (t - z)) + (input - z);
85 operator double()
const 87 #ifdef CHECK_STABLESUM 89 if(
spxAbs(checksum - (sum + c)) >= 1e-6)
90 printf(
"stablesum viol: %g, rel: %g, checksum: %g\n",
spxAbs(checksum - (sum + c)),
93 assert(
spxAbs(checksum - (sum + c)) < 1e-6);
101 std::ostream& operator<<(std::ostream& s, const StableSum<T>&
sum)
103 s << static_cast<T>(
sum);
void operator+=(double input)
void operator-=(double input)
void operator+=(const T &input)
Everything should be within this namespace.
std::remove_const< T >::type sum
void operator-=(const T &input)