diff options
author | Geert Bosch <geert@mongodb.com> | 2016-03-31 15:06:35 -0400 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2016-04-12 16:15:29 -0400 |
commit | f924b3fac16ac35ad000be0c6a4f1e1cf9d2c85c (patch) | |
tree | 0569fff95357469c51b615dd2b696da0f1484a48 /src/mongo/db | |
parent | 09b99e5c6659e60c992288e6b391bd2cb9e409c9 (diff) | |
download | mongo-f924b3fac16ac35ad000be0c6a4f1e1cf9d2c85c.tar.gz |
SERVER-19703 Add a few new Decimal128 methods/constructors for usage by KeyString
Make conversions explicit and allow control over precision in conversion from double.
Update uses to the new interface.
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/pipeline/value.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp index 704f922755b..cc35067b9da 100644 --- a/src/mongo/db/pipeline/value.cpp +++ b/src/mongo/db/pipeline/value.cpp @@ -822,7 +822,9 @@ void Value::hash_combine(size_t& seed) const { case mongo::NumberDecimal: { const Decimal128 dcml = getDecimal(); - if (dcml.toAbs().isGreater(Decimal128(std::numeric_limits<double>::max())) && + if (dcml.toAbs().isGreater(Decimal128(std::numeric_limits<double>::max(), + Decimal128::kRoundTo34Digits, + Decimal128::kRoundTowardZero)) && !dcml.isInfinite() && !dcml.isNaN()) { // Normalize our decimal to force equivalent decimals // in the same cohort to hash to the same value |