21 #ifndef TOLERANCE_COMPARISON_H 22 #define TOLERANCE_COMPARISON_H 24 #ifndef SHEAF_DLL_SPEC_H 25 #include "SheafSystem/sheaf_dll_spec.h" 29 #include "SheafSystem/std_limits.h" 33 #include "SheafSystem/std_cmath.h" 51 SHEAF_DLL_SPEC
inline bool a_eql_0(
float xf0)
59 SHEAF_DLL_SPEC
inline bool a_eql_0(
float xf0,
float xtolerance)
61 return std::abs(xf0) <= xtolerance;
67 SHEAF_DLL_SPEC
inline bool a_eql_1(
float xf0)
75 SHEAF_DLL_SPEC
inline bool a_eql_1(
float xf0,
float xtolerance)
77 return std::abs(xf0 - 1.0f) <= xtolerance;
83 SHEAF_DLL_SPEC
inline bool a_eql(
float xf0,
float xf1)
91 SHEAF_DLL_SPEC
inline bool a_eql(
float xf0,
float xf1,
float xtolerance)
93 return std::abs(xf0 - xf1) <= xtolerance;
99 SHEAF_DLL_SPEC
inline bool r_eql(
float xf0,
float xf1)
101 return std::abs(xf0 - xf1) <= float_tolerance*(std::abs(xf0) + std::abs(xf1));
107 SHEAF_DLL_SPEC
inline bool r_eql(
float xf0,
float xf1,
float xtolerance)
109 return std::abs(xf0 - xf1) <= xtolerance*(std::abs(xf0) + std::abs(xf1));
115 SHEAF_DLL_SPEC
inline bool c_eql(
float xf0,
float xf1)
117 return std::abs(xf0 - xf1) <= float_tolerance*(std::abs(xf0) + std::abs(xf1) + 1.0f);
123 SHEAF_DLL_SPEC
inline bool c_eql(
float xf0,
float xf1,
float xtolerance)
125 return std::abs(xf0 - xf1) <= xtolerance*(std::abs(xf0) + std::abs(xf1) + 1.0f);
141 SHEAF_DLL_SPEC
inline bool a_eql_0(
double xd0)
149 SHEAF_DLL_SPEC
inline bool a_eql_0(
double xd0,
double xtolerance)
151 return std::abs(xd0) <= xtolerance;
157 SHEAF_DLL_SPEC
inline bool a_eql_1(
double xd0)
165 SHEAF_DLL_SPEC
inline bool a_eql_1(
double xd0,
double xtolerance)
167 return std::abs(xd0 - 1.0) <= xtolerance;
173 SHEAF_DLL_SPEC
inline bool a_eql(
double xd0,
double xd1)
181 SHEAF_DLL_SPEC
inline bool a_eql(
double xd0,
double xd1,
double xtolerance)
183 return std::abs(xd0 - xd1) <= xtolerance;
189 SHEAF_DLL_SPEC
inline bool r_eql(
double xd0,
double xd1)
191 return std::abs(xd0 - xd1) <= double_tolerance*(std::abs(xd0) + std::abs(xd1));
197 SHEAF_DLL_SPEC
inline bool r_eql(
double xd0,
double xd1,
double xtolerance)
199 return std::abs(xd0 - xd1) <= xtolerance*(std::abs(xd0) + std::abs(xd1));
205 SHEAF_DLL_SPEC
inline bool c_eql(
double xd0,
double xd1)
207 return std::abs(xd0 - xd1) <= double_tolerance*(std::abs(xd0) + std::abs(xd1) + 1.0);
213 SHEAF_DLL_SPEC
inline bool c_eql(
double xd0,
double xd1,
double xtolerance)
215 return std::abs(xd0 - xd1) <= xtolerance*(std::abs(xd0) + std::abs(xd1) + 1.0);
226 SHEAF_DLL_SPEC
inline bool c_lte(
double xd0,
double xd1)
228 return xd0 <= (xd1 + double_tolerance*(std::abs(xd0) + std::abs(xd1) + 1.0));
234 SHEAF_DLL_SPEC
inline bool c_lte(
double xd0,
double xd1,
double xtolerance)
236 return xd0 <= (xd1 + xtolerance*(std::abs(xd0) + std::abs(xd1) + 1.0));
247 SHEAF_DLL_SPEC
inline bool c_lt(
double xd0,
double xd1)
249 return xd0 < (xd1 - double_tolerance*(std::abs(xd0) + std::abs(xd1) + 1.0));
255 SHEAF_DLL_SPEC
inline bool c_lt(
double xd0,
double xd1,
double xtolerance)
257 return xd0 < (xd1 - xtolerance*(std::abs(xd0) + std::abs(xd1) + 1.0));
268 SHEAF_DLL_SPEC
inline bool c_gte(
double xd0,
double xd1)
270 return xd0 >= (xd1 - double_tolerance*(std::abs(xd0) + std::abs(xd1) + 1.0));
276 SHEAF_DLL_SPEC
inline bool c_gte(
double xd0,
double xd1,
double xtolerance)
278 return xd0 >= (xd1 - xtolerance*(std::abs(xd0) + std::abs(xd1) + 1.0));
289 SHEAF_DLL_SPEC
inline bool c_gt(
double xd0,
double xd1)
291 return xd0 > (xd1 + double_tolerance*(std::abs(xd0) + std::abs(xd1) + 1.0));
297 SHEAF_DLL_SPEC
inline bool c_gt(
double xd0,
double xd1,
double xtolerance)
299 return xd0 > (xd1 + xtolerance*(std::abs(xd0) + std::abs(xd1) + 1.0));
307 #endif // ifndef TOLERANCE_COMPARISON_H SHEAF_DLL_SPEC void sqrt(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute sqrt of x0 (sqrt(x0)) (pre-allocated version).
SHEAF_DLL_SPEC bool a_eql_1(float xf0)
Absolute equality comparison of float xf0 to 1.0f using tolerance float_tolerance.
SHEAF_DLL_SPEC bool a_eql_0(float xf0)
Absolute equality comparison of float xf0 to 0.0f using tolerance float_tolerance.
SHEAF_DLL_SPEC bool c_eql(float xf0, float xf1)
Combined equality comparison of float xf0 to float xf1 using tolerance float_tolerance.
SHEAF_DLL_SPEC bool c_lt(double xd0, double xd1)
Combined less than comparison of double xd0 to double xd1 using tolerance double_tolerance.
const double double_tolerance
Tolerance for double comparisons.
SHEAF_DLL_SPEC bool c_lte(double xd0, double xd1)
Combined less than or equal comparison of double xd0 to double xd1 using tolerance double_tolerance...
SHEAF_DLL_SPEC bool c_gt(double xd0, double xd1)
Combined greater than comparison of double xd0 to double xd1 using tolerance double_tolerance.
SHEAF_DLL_SPEC bool r_eql(float xf0, float xf1)
Relative equality comparison of float xf0 to float xf1 using tolerance float_tolerance.
Namespace for the sheaves component of the sheaf system.
SHEAF_DLL_SPEC bool a_eql(float xf0, float xf1)
Absolute equality comparison of float xf0 to float xf1 using tolerance float_tolerance.
SHEAF_DLL_SPEC bool c_gte(double xd0, double xd1)
Combined greater than or equal comparison of double xd0 to double xd1 using tolerance double_toleranc...
const float float_tolerance
Tolerance for float comparisons.