MCPcopy Create free account
hub / github.com/antirez/botlib / compare_double

Function compare_double

cJSON.c:538–542  ·  view source on GitHub ↗

securely comparison of floating-point variables */

Source from the content-addressed store, hash-verified

536
537/* securely comparison of floating-point variables */
538static cJSON_bool compare_double(double a, double b)
539{
540 double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b);
541 return (fabs(a - b) <= maxVal * DBL_EPSILON);
542}
543
544/* Render the number nicely from the given item into a string. */
545static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer)

Callers 2

print_numberFunction · 0.85
cJSON_CompareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected