New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
test_input.hpp in vendors/XIOS/current/extern/boost/include/boost/numeric/interval/detail – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/numeric/interval/detail/test_input.hpp @ 3408

Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1/* Boost interval/detail/test_input.hpp file
2 *
3 * Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
4 *
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)
8 */
9
10#ifndef BOOST_NUMERIC_INTERVAL_DETAIL_TEST_INPUT_HPP
11#define BOOST_NUMERIC_INTERVAL_DETAIL_TEST_INPUT_HPP
12
13#include <boost/numeric/interval/detail/interval_prototype.hpp>
14
15namespace boost {
16namespace numeric {
17namespace interval_lib {
18namespace user {
19
20template<class T> inline
21bool is_zero(T const &v) { return v == static_cast<T>(0); }
22
23template<class T> inline
24bool is_neg (T const &v) { return v <  static_cast<T>(0); }
25
26template<class T> inline
27bool is_pos (T const &v) { return v >  static_cast<T>(0); }
28
29} // namespace user
30
31namespace detail {
32
33template<class T, class Policies> inline
34bool test_input(const interval<T, Policies>& x) {
35  typedef typename Policies::checking checking;
36  return checking::is_empty(x.lower(), x.upper());
37}
38
39template<class T, class Policies1, class Policies2> inline
40bool 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());
45}
46
47template<class T, class Policies> inline
48bool 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());
51}
52
53template<class T, class Policies> inline
54bool 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);
57}
58
59template<class T, class Policies> inline
60bool test_input(const T& x) {
61  typedef typename Policies::checking checking;
62  return checking::is_nan(x);
63}
64
65template<class T, class Policies> inline
66bool test_input(const T& x, const T& y) {
67  typedef typename Policies::checking checking;
68  return checking::is_nan(x) || checking::is_nan(y);
69}
70
71} // namespace detail
72} // namespace interval_lib
73} // namespace numeric
74} // namespace boost
75
76#endif // BOOST_NUMERIC_INTERVAL_DETAIL_TEST_INPUT_HPP
Note: See TracBrowser for help on using the repository browser.