35#ifndef NEKTAR_LIB_UTILITIES_REALCOMPARISON_H
36#define NEKTAR_LIB_UTILITIES_REALCOMPARISON_H
40#include <boost/math/special_functions/relative_difference.hpp>
49 class =
typename std::enable_if<
50 std::is_floating_point<
typename std::remove_cv<
51 typename std::remove_reference<T1>::type>::type>::value &&
52 std::is_same<
typename std::remove_cv<
53 typename std::remove_reference<T1>::type>::type,
54 typename std::remove_cv<
typename std::remove_reference<
55 T2>::type>::type>::value>::type>
61 ASSERTL1(factor >= 1,
"real comparison factor needs to be >= 1");
63 return boost::math::epsilon_difference(lhs, rhs) < factor;
69 class =
typename std::enable_if<
70 std::is_floating_point<
typename std::remove_cv<
71 typename std::remove_reference<T1>::type>::type>::value &&
72 std::is_same<
typename std::remove_cv<
73 typename std::remove_reference<T1>::type>::type,
74 typename std::remove_cv<
typename std::remove_reference<
75 T2>::type>::type>::value>::type>
80 ASSERTL1(tol >= 0,
"real comparison tolerance needs to be >= 0");
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
bool IsRealClose(T1 &&lhs, T2 &&rhs, const NekDouble tol=NekConstants::kNekMachineEpsilon)
compare reals of same type with absolute tolerance
bool IsRealEqual(T1 &&lhs, T2 &&rhs, const unsigned int factor=NekConstants::kNekFloatCompFact)
compare reals of same type with relative tolerance
static const unsigned int kNekFloatCompFact
static const NekDouble kNekMachineEpsilon
scalarT< T > abs(scalarT< T > in)