diff options
Diffstat (limited to 'unittests/ADT')
-rw-r--r-- | unittests/ADT/APFloatTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/unittests/ADT/APFloatTest.cpp b/unittests/ADT/APFloatTest.cpp index 00b62feaeb..c8d7177d86 100644 --- a/unittests/ADT/APFloatTest.cpp +++ b/unittests/ADT/APFloatTest.cpp @@ -689,6 +689,23 @@ TEST(APFloatTest, roundToIntegral) { P = R; P.roundToIntegral(APFloat::rmNearestTiesToEven); EXPECT_EQ(R.convertToDouble(), P.convertToDouble()); + + P = APFloat::getZero(APFloat::IEEEdouble); + P.roundToIntegral(APFloat::rmTowardZero); + EXPECT_EQ(0.0, P.convertToDouble()); + P = APFloat::getZero(APFloat::IEEEdouble, true); + P.roundToIntegral(APFloat::rmTowardZero); + EXPECT_EQ(-0.0, P.convertToDouble()); + P = APFloat::getNaN(APFloat::IEEEdouble); + P.roundToIntegral(APFloat::rmTowardZero); + EXPECT_TRUE(IsNAN(P.convertToDouble())); + P = APFloat::getInf(APFloat::IEEEdouble); + P.roundToIntegral(APFloat::rmTowardZero); + EXPECT_TRUE(IsInf(P.convertToDouble()) && P.convertToDouble() > 0.0); + P = APFloat::getInf(APFloat::IEEEdouble, true); + P.roundToIntegral(APFloat::rmTowardZero); + EXPECT_TRUE(IsInf(P.convertToDouble()) && P.convertToDouble() < 0.0); + } TEST(APFloatTest, getLargest) { |