2 namespace til { namespace fuzzy
5 //---------------------------------------------------------------------------
7 template < typename T >
10 is_positive(T x, T delta)
13 if (x >= delta) return true;
14 else if (x <= -delta) return false;
15 //else return boost::logic::tribool(boost::logic::indeterminate);
16 else return boost::logic::indeterminate;
19 //---------------------------------------------------------------------------
21 template < typename T >
24 same_sign(T x, T y, T delta)
26 // NB: I am not sure that this solution is actually much worse than what could be
27 // achieved by explicit checking, regarding the number of tests to make.
28 return fuzzy::is_positive(x, delta) == fuzzy::is_positive(y, delta);
31 //---------------------------------------------------------------------------
33 }} // namespace til::fuzzy