From f924b3fac16ac35ad000be0c6a4f1e1cf9d2c85c Mon Sep 17 00:00:00 2001 From: Geert Bosch Date: Thu, 31 Mar 2016 15:06:35 -0400 Subject: 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. --- src/mongo/db/pipeline/value.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mongo/db/pipeline/value.cpp') 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::max())) && + if (dcml.toAbs().isGreater(Decimal128(std::numeric_limits::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 -- cgit v1.2.1