Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/drtimcooper/XmlRpc4Win.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2016-05-21 00:43:41 +0300
committerKacper Michajłow <kasper93@gmail.com>2016-05-21 13:30:43 +0300
commitef3aba02354d07c985f6c3b7e75a3a6868354d0f (patch)
tree07395318deac815a3c3137e1a0a6085a23ff9bff
parent8893ed749a3ea73c81596be0a6973e18ad1a258e (diff)
Perform proper double type comparision.
-rw-r--r--TimXmlRpc.cpp4
1 files changed, 3 insertions, 1 deletions
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 <windows.h>
#include <wininet.h>
+#include <cmath>
#include <iterator>
+#include <limits>
#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<double>::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;