| 29 | namespace numeric { |
| 30 | |
| 31 | template<class T, class Policies> inline |
| 32 | interval<T, Policies> fmod(const interval<T, Policies>& x, |
| 33 | const interval<T, Policies>& y) |
| 34 | { |
| 35 | if (interval_lib::detail::test_input(x, y)) |
| 36 | return interval<T, Policies>::empty(); |
| 37 | typename Policies::rounding rnd; |
| 38 | typedef typename interval_lib::unprotect<interval<T, Policies> >::type I; |
| 39 | T const &yb = interval_lib::user::is_neg(x.lower()) ? y.lower() : y.upper(); |
| 40 | T n = rnd.int_down(rnd.div_down(x.lower(), yb)); |
| 41 | return (const I&)x - n * (const I&)y; |
| 42 | } |
| 43 | |
| 44 | template<class T, class Policies> inline |
| 45 | interval<T, Policies> fmod(const interval<T, Policies>& x, const T& y) |