diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-06-22 11:17:15 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-06-22 09:53:29 +0000 |
commit | abe3f614343da494248246f8c446a1ac0dab9e48 (patch) | |
tree | 27a32994f34a77a2e5e9dce4866bce1f55170953 /src/qml/jsruntime/qv4value.cpp | |
parent | 9cc9101f0416ebc352d157534b7c2ce009a44705 (diff) |
Fix sameValue again
Now to actually check if both values are 0
Change-Id: I138e34f6b884d45a4b01c7963b3518f2b36a4857
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4value.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4value.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp index d94d141c0b..4fd5597475 100644 --- a/src/qml/jsruntime/qv4value.cpp +++ b/src/qml/jsruntime/qv4value.cpp @@ -236,9 +236,11 @@ bool Value::sameValue(Value other) const { if (s && os) return s->isEqualTo(os); if (isInteger() && other.isDouble()) - return int_32() ? (double(int_32()) == other.doubleValue()) : !std::signbit(other.doubleValue()); + return int_32() ? (double(int_32()) == other.doubleValue()) + : (other.doubleValue() == 0 && !std::signbit(other.doubleValue())); if (isDouble() && other.isInteger()) - return other.int_32() ? (doubleValue() == double(other.int_32())) : !std::signbit(doubleValue()); + return other.int_32() ? (doubleValue() == double(other.int_32())) + : (doubleValue() == 0 && !std::signbit(doubleValue())); return false; } |