mirror of https://github.com/google/benchmark.git
Add epsilon check macros for float comparison.
This commit is contained in:
parent
e869e3749a
commit
8adf59d762
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <cstdlib>
|
||||
#include <ostream>
|
||||
#include <cmath>
|
||||
|
||||
#include "internal_macros.h"
|
||||
#include "log.h"
|
||||
|
@ -68,4 +69,11 @@ class CheckHandler {
|
|||
#define CHECK_GT(a, b) CHECK((a) > (b))
|
||||
#define CHECK_LT(a, b) CHECK((a) < (b))
|
||||
|
||||
#define CHECK_EQ_EPS(a, b, eps) CHECK(std::fabs((a) - (b)) < eps)
|
||||
#define CHECK_NE_EPS(a, b, eps) CHECK(std::fabs((a) - (b)) >= eps)
|
||||
#define CHECK_GE_EPS(a, b, eps) CHECK((a) - (b) > -eps)
|
||||
#define CHECK_LE_EPS(a, b, eps) CHECK((b) - (a) > -eps)
|
||||
#define CHECK_GT_EPS(a, b, eps) CHECK((a) - (b) > eps)
|
||||
#define CHECK_LT_EPS(a, b, eps) CHECK((b) - (a) > eps)
|
||||
|
||||
#endif // CHECK_H_
|
||||
|
|
Loading…
Reference in New Issue