From: Lars Knoll Date: Sat, 16 Feb 2013 22:26:16 +0000 (+0100) Subject: Fix the sameValue algorithm when comparing ints to doubles. X-Git-Tag: upstream/5.2.1~669^2~659^2~212 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78e7edb64ef814a59072bf36ff2f2a95fa8eceac;p=platform%2Fupstream%2Fqtdeclarative.git Fix the sameValue algorithm when comparing ints to doubles. Change-Id: I96fb3e8c47a336ef4e0e3cab44e6dfd4d5aff70a Reviewed-by: Simon Hausmann --- diff --git a/src/v4/qmljs_value.cpp b/src/v4/qmljs_value.cpp index 91f4ec8..892bcdf 100644 --- a/src/v4/qmljs_value.cpp +++ b/src/v4/qmljs_value.cpp @@ -92,10 +92,10 @@ bool Value::sameValue(Value other) const { return true; if (isString() && other.isString()) return stringValue()->isEqualTo(other.stringValue()); - if (isInteger() && int_32 == 0 && other.dbl == 0) - return true; - if (dbl == 0 && other.isInteger() && other.int_32 == 0) - return true; + if (isInteger()) + return int_32 ? (double(int_32) == other.dbl) : (other.val == 0); + if (other.isInteger()) + return other.int_32 ? (dbl == double(other.int_32)) : (val == 0); return false; }