annotate DEPENDENCIES/generic/include/boost/numeric/interval/arith3.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /* Boost interval/arith3.hpp template implementation file
Chris@16 2 *
Chris@16 3 * This headers provides arithmetical functions
Chris@16 4 * which compute an interval given some base
Chris@16 5 * numbers. The resulting interval encloses the
Chris@16 6 * real result of the arithmetic operation.
Chris@16 7 *
Chris@16 8 * Copyright 2003 Guillaume Melquiond
Chris@16 9 *
Chris@16 10 * Distributed under the Boost Software License, Version 1.0.
Chris@16 11 * (See accompanying file LICENSE_1_0.txt or
Chris@16 12 * copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 13 */
Chris@16 14
Chris@16 15 #ifndef BOOST_NUMERIC_INTERVAL_ARITH3_HPP
Chris@16 16 #define BOOST_NUMERIC_INTERVAL_ARITH3_HPP
Chris@16 17
Chris@16 18 #include <boost/numeric/interval/detail/interval_prototype.hpp>
Chris@16 19 #include <boost/numeric/interval/detail/test_input.hpp>
Chris@16 20
Chris@16 21 namespace boost {
Chris@16 22 namespace numeric {
Chris@16 23 namespace interval_lib {
Chris@16 24
Chris@16 25 template<class I> inline
Chris@16 26 I add(const typename I::base_type& x, const typename I::base_type& y)
Chris@16 27 {
Chris@16 28 typedef typename I::traits_type Policies;
Chris@16 29 if (detail::test_input<typename I::base_type, Policies>(x, y))
Chris@16 30 return I::empty();
Chris@16 31 typename Policies::rounding rnd;
Chris@16 32 return I(rnd.add_down(x, y), rnd.add_up(x, y), true);
Chris@16 33 }
Chris@16 34
Chris@16 35 template<class I> inline
Chris@16 36 I sub(const typename I::base_type& x, const typename I::base_type& y)
Chris@16 37 {
Chris@16 38 typedef typename I::traits_type Policies;
Chris@16 39 if (detail::test_input<typename I::base_type, Policies>(x, y))
Chris@16 40 return I::empty();
Chris@16 41 typename Policies::rounding rnd;
Chris@16 42 return I(rnd.sub_down(x, y), rnd.sub_up(x, y), true);
Chris@16 43 }
Chris@16 44
Chris@16 45 template<class I> inline
Chris@16 46 I mul(const typename I::base_type& x, const typename I::base_type& y)
Chris@16 47 {
Chris@16 48 typedef typename I::traits_type Policies;
Chris@16 49 if (detail::test_input<typename I::base_type, Policies>(x, y))
Chris@16 50 return I::empty();
Chris@16 51 typename Policies::rounding rnd;
Chris@16 52 return I(rnd.mul_down(x, y), rnd.mul_up(x, y), true);
Chris@16 53 }
Chris@16 54
Chris@16 55 template<class I> inline
Chris@16 56 I div(const typename I::base_type& x, const typename I::base_type& y)
Chris@16 57 {
Chris@16 58 typedef typename I::traits_type Policies;
Chris@16 59 if (detail::test_input<typename I::base_type, Policies>(x, y) || user::is_zero(y))
Chris@16 60 return I::empty();
Chris@16 61 typename Policies::rounding rnd;
Chris@16 62 return I(rnd.div_down(x, y), rnd.div_up(x, y), true);
Chris@16 63 }
Chris@16 64
Chris@16 65 } // namespace interval_lib
Chris@16 66 } // namespace numeric
Chris@16 67 } // namespace boost
Chris@16 68
Chris@16 69 #endif // BOOST_NUMERIC_INTERVAL_ARITH3_HPP