diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2016-05-21 00:43:41 +0300 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2016-05-21 13:30:43 +0300 |
commit | ef3aba02354d07c985f6c3b7e75a3a6868354d0f (patch) | |
tree | 07395318deac815a3c3137e1a0a6085a23ff9bff /TimXmlRpc.cpp | |
parent | 8893ed749a3ea73c81596be0a6973e18ad1a258e (diff) |
Perform proper double type comparision.
Diffstat (limited to 'TimXmlRpc.cpp')
-rw-r--r-- | TimXmlRpc.cpp | 4 |
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; |