os/ossrv/ossrv_pub/boost_apis/boost/numeric/interval/arith3.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/numeric/interval/arith3.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,69 @@
     1.4 +/* Boost interval/arith3.hpp template implementation file
     1.5 + *
     1.6 + * This headers provides arithmetical functions
     1.7 + * which compute an interval given some base
     1.8 + * numbers. The resulting interval encloses the
     1.9 + * real result of the arithmetic operation.
    1.10 + *
    1.11 + * Copyright 2003 Guillaume Melquiond
    1.12 + *
    1.13 + * Distributed under the Boost Software License, Version 1.0.
    1.14 + * (See accompanying file LICENSE_1_0.txt or
    1.15 + * copy at http://www.boost.org/LICENSE_1_0.txt)
    1.16 + */
    1.17 +
    1.18 +#ifndef BOOST_NUMERIC_INTERVAL_ARITH3_HPP
    1.19 +#define BOOST_NUMERIC_INTERVAL_ARITH3_HPP
    1.20 +
    1.21 +#include <boost/numeric/interval/detail/interval_prototype.hpp>
    1.22 +#include <boost/numeric/interval/detail/test_input.hpp>
    1.23 +
    1.24 +namespace boost {
    1.25 +namespace numeric {
    1.26 +namespace interval_lib {
    1.27 +
    1.28 +template<class I> inline
    1.29 +I add(const typename I::base_type& x, const typename I::base_type& y)
    1.30 +{
    1.31 +  typedef typename I::traits_type Policies;
    1.32 +  if (detail::test_input<typename I::base_type, Policies>(x, y))
    1.33 +    return I::empty();
    1.34 +  typename Policies::rounding rnd;
    1.35 +  return I(rnd.add_down(x, y), rnd.add_up(x, y), true);
    1.36 +}
    1.37 +
    1.38 +template<class I> inline
    1.39 +I sub(const typename I::base_type& x, const typename I::base_type& y)
    1.40 +{
    1.41 +  typedef typename I::traits_type Policies;
    1.42 +  if (detail::test_input<typename I::base_type, Policies>(x, y))
    1.43 +    return I::empty();
    1.44 +  typename Policies::rounding rnd;
    1.45 +  return I(rnd.sub_down(x, y), rnd.sub_up(x, y), true);
    1.46 +}
    1.47 +
    1.48 +template<class I> inline
    1.49 +I mul(const typename I::base_type& x, const typename I::base_type& y)
    1.50 +{
    1.51 +  typedef typename I::traits_type Policies;
    1.52 +  if (detail::test_input<typename I::base_type, Policies>(x, y))
    1.53 +    return I::empty();
    1.54 +  typename Policies::rounding rnd;
    1.55 +  return I(rnd.mul_down(x, y), rnd.mul_up(x, y), true);
    1.56 +}
    1.57 +
    1.58 +template<class I> inline
    1.59 +I div(const typename I::base_type& x, const typename I::base_type& y)
    1.60 +{
    1.61 +  typedef typename I::traits_type Policies;
    1.62 +  if (detail::test_input<typename I::base_type, Policies>(x, y) || user::is_zero(y))
    1.63 +    return I::empty();
    1.64 +  typename Policies::rounding rnd;
    1.65 +  return I(rnd.div_down(x, y), rnd.div_up(x, y), true);
    1.66 +}
    1.67 +
    1.68 +} // namespace interval_lib
    1.69 +} // namespace numeric
    1.70 +} // namespace boost
    1.71 +
    1.72 +#endif // BOOST_NUMERIC_INTERVAL_ARITH3_HPP