Add exactly_zero call

This commit is contained in:
Danny Robson 2012-05-08 16:39:58 +10:00
parent 7ddc076916
commit 474a808f79

View File

@ -88,11 +88,28 @@ almost_equal (const Ta &a, const Tb &b)
{ return a == b; } { return a == b; }
// Useful for explictly ignore equality warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
template <typename T>
bool
exactly_equal (const T &a, const T &b)
{ return a == b; }
#pragma GCC diagnostic pop
template <typename T> template <typename T>
bool bool
almost_zero (T a) almost_zero (T a)
{ return almost_equal (a, 0); } { return almost_equal (a, 0); }
template <typename T>
bool
exactly_zero (T a)
{ return exactly_equal (a, static_cast<T> (0)); }
const double PI = 3.141592653589793238462643; const double PI = 3.141592653589793238462643;
inline double inline double
@ -116,15 +133,6 @@ bool
almost_equal (const double &a, const double &b); almost_equal (const double &a, const double &b);
// Useful for explictly ignore equality warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
template <typename T>
bool
exactly_equal (const T &a, const T &b)
{ return a == b; }
#pragma GCC diagnostic pop
/// Variadic minimum /// Variadic minimum
template <typename T> template <typename T>
const T& const T&