Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / mozglue / misc / decimal / comparison-with-nan.patch
blob0e274ce033bad5e9188e992fa1415bdd83a1eed9
1 diff --git a/mozglue/misc/decimal/Decimal.cpp b/mozglue/misc/decimal/Decimal.cpp
2 --- a/mozglue/misc/decimal/Decimal.cpp
3 +++ b/mozglue/misc/decimal/Decimal.cpp
4 @@ -509,21 +509,25 @@ Decimal Decimal::operator/(const Decimal
5 if (remainder > divisor / 2)
6 ++result;
8 return Decimal(resultSign, resultExponent, result);
11 bool Decimal::operator==(const Decimal& rhs) const
13 + if (isNaN() || rhs.isNaN())
14 + return false;
15 return m_data == rhs.m_data || compareTo(rhs).isZero();
18 bool Decimal::operator!=(const Decimal& rhs) const
20 + if (isNaN() || rhs.isNaN())
21 + return true;
22 if (m_data == rhs.m_data)
23 return false;
24 const Decimal result = compareTo(rhs);
25 if (result.isNaN())
26 return false;
27 return !result.isZero();
30 @@ -532,16 +536,18 @@ bool Decimal::operator<(const Decimal& r
31 const Decimal result = compareTo(rhs);
32 if (result.isNaN())
33 return false;
34 return !result.isZero() && result.isNegative();
37 bool Decimal::operator<=(const Decimal& rhs) const
39 + if (isNaN() || rhs.isNaN())
40 + return false;
41 if (m_data == rhs.m_data)
42 return true;
43 const Decimal result = compareTo(rhs);
44 if (result.isNaN())
45 return false;
46 return result.isZero() || result.isNegative();
49 @@ -550,16 +556,18 @@ bool Decimal::operator>(const Decimal& r
50 const Decimal result = compareTo(rhs);
51 if (result.isNaN())
52 return false;
53 return !result.isZero() && result.isPositive();
56 bool Decimal::operator>=(const Decimal& rhs) const
58 + if (isNaN() || rhs.isNaN())
59 + return false;
60 if (m_data == rhs.m_data)
61 return true;
62 const Decimal result = compareTo(rhs);
63 if (result.isNaN())
64 return false;
65 return result.isZero() || !result.isNegative();