MCPcopy Create free account
hub / github.com/DaveGamble/cJSON / compare_double

Function compare_double

cJSON.c:584–588  ·  view source on GitHub ↗

securely comparison of floating-point variables */

Source from the content-addressed store, hash-verified

582
583/* securely comparison of floating-point variables */
584static cJSON_bool compare_double(double a, double b)
585{
586 double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b);
587 return (fabs(a - b) <= maxVal * DBL_EPSILON);
588}
589
590/* Render the number nicely from the given item into a string. */
591static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer)

Callers 3

print_numberFunction · 0.70
cJSON_CompareFunction · 0.70
supports_full_hdFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…