Listing 7: Some simple binary functions
UDouble::UDouble<is_correlated> &operator +=(const UDouble<is_correlated>& ud) { if (is_correlated) uncertainty += ud.uncertainty; else uncertainty = hypot(uncertainty, ud.uncertainty); value += ud.value; return *this; } UDouble::UDouble<is_correlated> &operator /=(const UDouble<is_correlated>& ud) { if (is_correlated) uncertainty = uncertainty / ud.value - (ud.uncertainty * value) / (ud.value * ud.value); else uncertainty = hypot(uncertainty / ud.value, (ud.uncertainty * value) / (ud.value * ud.value)); value /= ud.value; return *this; } //End of File