Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/numeric/interval/detail/test_input.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* Boost interval/detail/test_input.hpp file
0002  *
0003  * Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
0004  *
0005  * Distributed under the Boost Software License, Version 1.0.
0006  * (See accompanying file LICENSE_1_0.txt or
0007  * copy at http://www.boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_NUMERIC_INTERVAL_DETAIL_TEST_INPUT_HPP
0011 #define BOOST_NUMERIC_INTERVAL_DETAIL_TEST_INPUT_HPP
0012 
0013 #include <boost/numeric/interval/detail/interval_prototype.hpp>
0014 
0015 namespace boost {
0016 namespace numeric {
0017 namespace interval_lib {
0018 namespace user {
0019 
0020 template<class T> inline
0021 bool is_zero(T const &v) { return v == static_cast<T>(0); }
0022 
0023 template<class T> inline
0024 bool is_neg (T const &v) { return v <  static_cast<T>(0); }
0025 
0026 template<class T> inline
0027 bool is_pos (T const &v) { return v >  static_cast<T>(0); }
0028 
0029 } // namespace user
0030 
0031 namespace detail {
0032 
0033 template<class T, class Policies> inline
0034 bool test_input(const interval<T, Policies>& x) {
0035   typedef typename Policies::checking checking;
0036   return checking::is_empty(x.lower(), x.upper());
0037 }
0038 
0039 template<class T, class Policies1, class Policies2> inline
0040 bool test_input(const interval<T, Policies1>& x, const interval<T, Policies2>& y) {
0041   typedef typename Policies1::checking checking1;
0042   typedef typename Policies2::checking checking2;
0043   return checking1::is_empty(x.lower(), x.upper()) ||
0044          checking2::is_empty(y.lower(), y.upper());
0045 }
0046 
0047 template<class T, class Policies> inline
0048 bool test_input(const T& x, const interval<T, Policies>& y) {
0049   typedef typename Policies::checking checking;
0050   return checking::is_nan(x) || checking::is_empty(y.lower(), y.upper());
0051 }
0052 
0053 template<class T, class Policies> inline
0054 bool test_input(const interval<T, Policies>& x, const T& y) {
0055   typedef typename Policies::checking checking;
0056   return checking::is_empty(x.lower(), x.upper()) || checking::is_nan(y);
0057 }
0058 
0059 template<class T, class Policies> inline
0060 bool test_input(const T& x) {
0061   typedef typename Policies::checking checking;
0062   return checking::is_nan(x);
0063 }
0064 
0065 template<class T, class Policies> inline
0066 bool test_input(const T& x, const T& y) {
0067   typedef typename Policies::checking checking;
0068   return checking::is_nan(x) || checking::is_nan(y);
0069 }
0070 
0071 } // namespace detail
0072 } // namespace interval_lib
0073 } // namespace numeric
0074 } // namespace boost
0075 
0076 #endif // BOOST_NUMERIC_INTERVAL_DETAIL_TEST_INPUT_HPP