mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
f5ad611e1f
--HG-- extra : rebase_source : 00746c16dc88e2b87488cc95171d84b48c62b151
68 lines
1.8 KiB
Diff
68 lines
1.8 KiB
Diff
diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
|
|
--- a/mfbt/decimal/Decimal.cpp
|
|
+++ b/mfbt/decimal/Decimal.cpp
|
|
@@ -509,21 +509,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();
|
|
}
|
|
|
|
@@ -532,16 +536,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();
|
|
}
|
|
|
|
@@ -550,16 +556,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();
|
|
}
|
|
|