35#ifndef NEKTAR_LIB_UTILITIES_REALCOMPARISON_H
36#define NEKTAR_LIB_UTILITIES_REALCOMPARISON_H
40#include <boost/math/special_functions/relative_difference.hpp>
51 class =
typename std::enable_if<
52 std::is_floating_point<
typename std::remove_cv<
53 typename std::remove_reference<T1>::type>::type>::value &&
54 std::is_same<
typename std::remove_cv<
55 typename std::remove_reference<T1>::type>::type,
56 typename std::remove_cv<
typename std::remove_reference<
57 T2>::type>::type>::value>::type>
63 ASSERTL1(factor >= 1,
"real comparison factor needs to be >= 1");
65 return boost::math::epsilon_difference(lhs, rhs) < factor;
71 class =
typename std::enable_if<
72 std::is_floating_point<
typename std::remove_cv<
73 typename std::remove_reference<T1>::type>::type>::value &&
74 std::is_same<
typename std::remove_cv<
75 typename std::remove_reference<T1>::type>::type,
76 typename std::remove_cv<
typename std::remove_reference<
77 T2>::type>::type>::value>::type>
82 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
The above copyright notice and this permission notice shall be included.
scalarT< T > abs(scalarT< T > in)