mfbt/decimal/comparison-with-nan.patch
author B2G Bumper Bot <release+b2gbumper@mozilla.com>
Wed, 30 Apr 2014 04:08:23 -0700
changeset 181455 32593254aa0d9f6f22e4c7b262b22f2f51a16b22
parent 131277 f40200a441622c0c73be1eb5789b9c185da46cb5
permissions -rw-r--r--
Bumping manifests a=b2g-bump

diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
--- a/mfbt/decimal/Decimal.cpp
+++ b/mfbt/decimal/Decimal.cpp
@@ -505,21 +505,25 @@ Decimal Decimal::operator/(const Decimal
     if (remainder > divisor / 2)
         ++result;
 
     return Decimal(resultSign, resultExponent, result);
 }
 
 bool Decimal::operator==(const Decimal& rhs) const
 {
+    if (isNaN() || rhs.isNaN())
+        return false;
     return m_data == rhs.m_data || compareTo(rhs).isZero();
 }
 
 bool Decimal::operator!=(const Decimal& rhs) const
 {
+    if (isNaN() || rhs.isNaN())
+        return true;
     if (m_data == rhs.m_data)
         return false;
     const Decimal result = compareTo(rhs);
     if (result.isNaN())
         return false;
     return !result.isZero();
 }
 
@@ -528,16 +532,18 @@ bool Decimal::operator<(const Decimal& r
     const Decimal result = compareTo(rhs);
     if (result.isNaN())
         return false;
     return !result.isZero() && result.isNegative();
 }
 
 bool Decimal::operator<=(const Decimal& rhs) const
 {
+    if (isNaN() || rhs.isNaN())
+        return false;
     if (m_data == rhs.m_data)
         return true;
     const Decimal result = compareTo(rhs);
     if (result.isNaN())
         return false;
     return result.isZero() || result.isNegative();
 }
 
@@ -546,16 +552,18 @@ bool Decimal::operator>(const Decimal& r
     const Decimal result = compareTo(rhs);
     if (result.isNaN())
         return false;
     return !result.isZero() && result.isPositive();
 }
 
 bool Decimal::operator>=(const Decimal& rhs) const
 {
+    if (isNaN() || rhs.isNaN())
+        return false;
     if (m_data == rhs.m_data)
         return true;
     const Decimal result = compareTo(rhs);
     if (result.isNaN())
         return false;
     return result.isZero() || !result.isNegative();
 }