1
/* Boost interval/detail/test_input.hpp file
3
* Copyright 2002 Herv� Br�nnimann, Guillaume Melquiond, Sylvain Pion
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE_1_0.txt or
7
* copy at http://www.boost.org/LICENSE_1_0.txt)
10
#ifndef BOOST_NUMERIC_INTERVAL_DETAIL_TEST_INPUT_HPP
11
#define BOOST_NUMERIC_INTERVAL_DETAIL_TEST_INPUT_HPP
13
#include <boost/numeric/interval/detail/interval_prototype.hpp>
17
namespace interval_lib {
20
template<class T> inline
21
bool is_zero(T const &v) { return v == static_cast<T>(0); }
23
template<class T> inline
24
bool is_neg (T const &v) { return v < static_cast<T>(0); }
26
template<class T> inline
27
bool is_pos (T const &v) { return v > static_cast<T>(0); }
33
template<class T, class Policies> inline
34
bool test_input(const interval<T, Policies>& x) {
35
typedef typename Policies::checking checking;
36
return checking::is_empty(x.lower(), x.upper());
39
template<class T, class Policies1, class Policies2> inline
40
bool test_input(const interval<T, Policies1>& x, const interval<T, Policies2>& y) {
41
typedef typename Policies1::checking checking1;
42
typedef typename Policies2::checking checking2;
43
return checking1::is_empty(x.lower(), x.upper()) ||
44
checking2::is_empty(y.lower(), y.upper());
47
template<class T, class Policies> inline
48
bool test_input(const T& x, const interval<T, Policies>& y) {
49
typedef typename Policies::checking checking;
50
return checking::is_nan(x) || checking::is_empty(y.lower(), y.upper());
53
template<class T, class Policies> inline
54
bool test_input(const interval<T, Policies>& x, const T& y) {
55
typedef typename Policies::checking checking;
56
return checking::is_empty(x.lower(), x.upper()) || checking::is_nan(y);
59
template<class T, class Policies> inline
60
bool test_input(const T& x) {
61
typedef typename Policies::checking checking;
62
return checking::is_nan(x);
65
template<class T, class Policies> inline
66
bool test_input(const T& x, const T& y) {
67
typedef typename Policies::checking checking;
68
return checking::is_nan(x) || checking::is_nan(y);
72
} // namespace interval_lib
73
} // namespace numeric
76
#endif // BOOST_NUMERIC_INTERVAL_DETAIL_TEST_INPUT_HPP