From 4e3335618f4bf9583838dc254427f2307c5879e2 Mon Sep 17 00:00:00 2001 From: Alanscut Date: Mon, 9 Dec 2019 10:36:45 +0800 Subject: [PATCH] improve compare_double --- cJSON_Utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON_Utils.c b/cJSON_Utils.c index 805a9d4..1cbd80a 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -109,7 +109,7 @@ static int compare_strings(const unsigned char *string1, const unsigned char *st /* securely comparison of floating-point variables */ static cJSON_bool compare_double(double a, double b) { - return (fabs(a - b) <= a * CJSON_DOUBLE_PRECISION); + return (fabs(a - b) <= CJSON_DOUBLE_PRECISION); }