MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / double_eq_rel

Function double_eq_rel

deps/jemalloc/test/unit/math.c:16–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#endif
15
16static bool
17double_eq_rel(double a, double b, double max_rel_err, double max_abs_err) {
18 double rel_err;
19
20 if (fabs(a - b) < max_abs_err) {
21 return true;
22 }
23 rel_err = (fabs(b) > fabs(a)) ? fabs((a-b)/b) : fabs((a-b)/a);
24 return (rel_err < max_rel_err);
25}
26
27static uint64_t
28factorial(unsigned x) {

Callers 2

math.cFile · 0.70
TEST_BEGINFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected