summaryrefslogtreecommitdiff
path: root/src/mongo/platform/decimal128_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/platform/decimal128_test.cpp')
-rw-r--r--src/mongo/platform/decimal128_test.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/platform/decimal128_test.cpp b/src/mongo/platform/decimal128_test.cpp
index a9f09aa893f..eea0480780e 100644
--- a/src/mongo/platform/decimal128_test.cpp
+++ b/src/mongo/platform/decimal128_test.cpp
@@ -202,6 +202,13 @@ TEST(Decimal128Test, TestDoubleConstructorMaxRoundUp) {
ASSERT_EQUALS(d.toString(), "1.79769313486232E+308");
}
+TEST(Decimal128Test, TestDoubleConstructorRoundAllNines) {
+ double allNines = 0.999999999999999; // 15 nines
+ Decimal128 d(
+ allNines, Decimal128::kRoundTo15Digits, Decimal128::RoundingMode::kRoundTiesToAway);
+ ASSERT_EQUALS(d.toString(), "0.999999999999999"); // 15 nines
+}
+
TEST(Decimal128Test, TestDoubleConstructorMaxNeg) {
double doubleMax = -1 * DBL_MAX;
Decimal128 d(doubleMax);