diff options
author | Geert Bosch <geert.bosch@mongodb.com> | 2019-10-02 17:14:46 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-02 17:14:46 +0000 |
commit | 9d31de1d5458e865439e643eb75f719d5217d064 (patch) | |
tree | 9f655522b791f824451888b383a4b2679b8dad86 /src/mongo/util/summation.h | |
parent | 22d98f57d8d1f8efe442c4c63fdd245b65c8861b (diff) | |
download | mongo-9d31de1d5458e865439e643eb75f719d5217d064.tar.gz |
SERVER-43034 Correctly deal with infinite results in DoubleDoubleSummation
Diffstat (limited to 'src/mongo/util/summation.h')
-rw-r--r-- | src/mongo/util/summation.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/util/summation.h b/src/mongo/util/summation.h index 1da8efe4bb1..d199fc304a7 100644 --- a/src/mongo/util/summation.h +++ b/src/mongo/util/summation.h @@ -91,9 +91,9 @@ public: * Summations of even extremely long series of 32-bit and 64-bit integers should be exact. */ Decimal128 getDecimal() const { - return std::isnan(_sum) ? Decimal128(_special, Decimal128::kRoundTo34Digits) - : Decimal128(_sum, Decimal128::kRoundTo34Digits) - .add(Decimal128(_addend, Decimal128::kRoundTo34Digits)); + return !std::isfinite(_sum) ? Decimal128(_special, Decimal128::kRoundTo34Digits) + : Decimal128(_sum, Decimal128::kRoundTo34Digits) + .add(Decimal128(_addend, Decimal128::kRoundTo34Digits)); } /** |