> Unfortunately C++ STL does not offer anything close to isclose
maybe because you can trivially write it yourself with whatever precision you want:
float a = 0.1;
float b = 0.2;
// now test for equality to within half of the smallest
// value float can represent
bool equal = fabs (0.3 - (a + b)) < (FLT_EPSILON/2);
Variations are left to the reader. There are a few optimizations one can do but this version conveys the basic point: you get to specify the semantics of isclose()
maybe because you can trivially write it yourself with whatever precision you want:
Alternatively: Variations are left to the reader. There are a few optimizations one can do but this version conveys the basic point: you get to specify the semantics of isclose()