瀏覽代碼

improve compare_double

Alanscut 5 年之前
父節點
當前提交
4e3335618f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      cJSON_Utils.c

+ 1 - 1
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);
 }