From fd2ba0bc44c97147694cce5c5e965bb7d2f370d5 Mon Sep 17 00:00:00 2001 From: "Philipp A. Hartmann" Date: Sun, 31 Aug 2014 18:58:14 +0200 Subject: [PATCH] GenericValue: fix comparison of (Ui|I)nt64 numbers Some 64-bit integers cannot be represented losslessly as a double. Due to a typo in the operator==, the comparison has been performed after a double conversion in too many cases. --- include/rapidjson/document.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 92c7316..ec7f8a6 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -662,7 +662,7 @@ public: return StringEqual(rhs); case kNumberType: - if (IsDouble() || rhs.GetDouble()) + if (IsDouble() || rhs.IsDouble()) return GetDouble() == rhs.GetDouble(); // May convert one operand from integer to double. else return data_.n.u64 == rhs.data_.n.u64;