| 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; |
| 7 |
|
| 8 |
return Decimal(resultSign, resultExponent, result); |
| 9 |
} |
| 10 |
|
| 11 |
bool Decimal::operator==(const Decimal& rhs) const |
| 12 |
{ |
| 13 |
+ if (isNaN() || rhs.isNaN()) |
| 14 |
+ return false; |
| 15 |
return m_data == rhs.m_data || compareTo(rhs).isZero(); |
| 16 |
} |
| 17 |
|
| 18 |
bool Decimal::operator!=(const Decimal& rhs) const |
| 19 |
{ |
| 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(); |
| 28 |
} |
| 29 |
|
| 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(); |
| 35 |
} |
| 36 |
|
| 37 |
bool Decimal::operator<=(const Decimal& rhs) const |
| 38 |
{ |
| 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(); |
| 47 |
} |
| 48 |
|
| 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(); |
| 54 |
} |
| 55 |
|
| 56 |
bool Decimal::operator>=(const Decimal& rhs) const |
| 57 |
{ |
| 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(); |
| 66 |
} |
| 67 |
|