aimstil  5.0.5
fuzzy_logic.h
Go to the documentation of this file.
1 #ifndef TIL_FUZZY_LOGIC_H
2 #define TIL_FUZZY_LOGIC_H
3 
7 
8 // includes from STL
9 #include <limits>
10 
11 // includes from BOOST
12 #include <boost/logic/tribool.hpp>
13 
14 
15 namespace til { namespace fuzzy
16 {
17 
18  //---------------------------------------------------------------------------
19 
25  template < typename T >
26  inline
27  boost::logic::tribool
28  is_positive(T x, T delta = 128*std::numeric_limits<T>::epsilon());
29 
30  //---------------------------------------------------------------------------
31 
34  // NB: I think it is a good idea to keep the name different from the function above, rather than overloading
35  // using a disable_if on numeric_limits::is_integer. The mechanism is really different and we loose some properties
36  // like transitivity by using this fuzzy version, so better keep the user aware of the change.
37  template < typename T >
38  inline
39  boost::logic::tribool
40  same_sign(T x, T y, T delta = 128*std::numeric_limits<T>::epsilon());
41 
42  //---------------------------------------------------------------------------
43 
44 }} // namespace til::fuzzy
45 
46 // package include
47 #include "fuzzy_logic.tpp"
48 
49 #endif
50 
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
boost::logic::tribool same_sign(T x, T y, T delta=128 *std::numeric_limits< T >::epsilon())
Returns true iff both arguments have same sign, allowing some degree of imprecision.
boost::logic::tribool is_positive(T x, T delta=128 *std::numeric_limits< T >::epsilon())
Tests whether x is positive, with a +- delta uncertainty cushion.