MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / compare_double

Function compare_double

TheForceEngine/TFE_System/cJSON.c:543–547  ·  view source on GitHub ↗

securely comparison of floating-point variables */

Source from the content-addressed store, hash-verified

541
542/* securely comparison of floating-point variables */
543static cJSON_bool compare_double(double a, double b)
544{
545 double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b);
546 return (fabs(a - b) <= maxVal * DBL_EPSILON);
547}
548
549/* Render the number nicely from the given item into a string. */
550static 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