From ef3aba02354d07c985f6c3b7e75a3a6868354d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 20 May 2016 23:43:41 +0200 Subject: Perform proper double type comparision. --- TimXmlRpc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TimXmlRpc.cpp b/TimXmlRpc.cpp index 6b860d5..13e0ec2 100644 --- a/TimXmlRpc.cpp +++ b/TimXmlRpc.cpp @@ -21,7 +21,9 @@ work with the token: "/*ChrisMorley/". Thanks, Chris! #include #include +#include #include +#include #include "TimXmlRpc.h" @@ -689,7 +691,7 @@ bool XmlRpcValue::operator==(XmlRpcValue const& other) const case TypeBoolean: return ( !u.asBool && !other.u.asBool) || ( u.asBool && other.u.asBool); case TypeInt: return u.asInt == other.u.asInt; - case TypeDouble: return u.asDouble == other.u.asDouble; + case TypeDouble: return std::abs(u.asDouble - other.u.asDouble) < std::numeric_limits::epsilon(); case TypeDateTime: return tmEq(*u.asTime, *other.u.asTime); case TypeString: return *u.asString == *other.u.asString; case TypeBase64: return *u.asBinary == *other.u.asBinary; -- cgit v1.2.3