kaycxx-assert
C++ assertion library
Loading...
Searching...
No Matches
assert_close

Asserts that two numeric values are equal after rounding to a decimal precision.

The default precision is 2 decimal digits. Integral values are compared exactly. Boolean values are rejected because closeness is a numeric relation, not a truth-value relation.

using namespace kaycxx::assert;
int main() {
assert_close(1.234, 1.233);
assert_close(3.14159, 3.142, 3);
assert_close(42, 42);
}
Includes the complete public assertion API.
Assertion functions and related types.
Definition assert.hpp:15

Use assert_close for result values where small floating-point differences are acceptable after rounding.