template<class I> inline I add(const typename I::base_type& x, const typename I::base_type& y) { typedef typename I::traits_type Policies; if (detail::test_input<typename I::base_type, Policies>(x, y)) return I::empty(); typename Policies::rounding rnd; return I(rnd.add_down(x, y), rnd.add_up(x, y), true); }
template<class T, class Policies> inline interval<T, Policies> operator+(const T& x, const interval<T, Policies>& y) { if (interval_lib::detail::test_input(x, y)) return interval<T, Policies>::empty(); typename Policies::rounding rnd; return interval<T,Policies>(rnd.add_down(x, y.lower()), rnd.add_up (x, y.upper()), true); }
template<class T, class Policies> inline interval<T, Policies>& interval<T, Policies>::operator+=(const T& r) { if (interval_lib::detail::test_input(*this, r)) set_empty(); else { typename Policies::rounding rnd; set(rnd.add_down(low, r), rnd.add_up(up, r)); } return *this; }