diff options
author | Geert Bosch <geert.bosch@mongodb.com> | 2019-10-17 16:19:37 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-17 16:19:37 +0000 |
commit | 8d959c8cd455cbf69c0c3681839695c0ebc25a84 (patch) | |
tree | 7d384da4920fdfa2466f5f9d2a9818cf4a04f6d6 /src | |
parent | 6d06698f139230feb43fb4ee56867f3b8ddf51a8 (diff) | |
download | mongo-8d959c8cd455cbf69c0c3681839695c0ebc25a84.tar.gz |
SERVER-43034 Correctly deal with infinite results in DoubleDoubleSummation
(cherry picked from commit 9d31de1d5458e865439e643eb75f719d5217d064)
Diffstat (limited to 'src')
-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 3ca36801b5b..5132d1cd581 100644 --- a/src/mongo/util/summation.h +++ b/src/mongo/util/summation.h @@ -92,9 +92,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)); } /** |