llvm.org GIT mirror llvm / c6c4c8b
Revert rL316156 due to failure on APFloatTest.fromToStringSpecials git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316158 91177308-0d34-0410-b5e6-96231b3b80d8 Max Kazantsev 1 year, 11 months ago
2 changed file(s) with 2 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
25422542 }
25432543
25442544 bool IEEEFloat::convertFromStringSpecials(StringRef str) {
2545 if (str.equals("inf") || str.equals("INFINITY") || str.equals("+Inf")) {
2545 if (str.equals("inf") || str.equals("INFINITY")) {
25462546 makeInf(false);
25472547 return true;
25482548 }
25492549
2550 if (str.equals("-inf") || str.equals("-INFINITY") || str.equals("-Inf")) {
2550 if (str.equals("-inf") || str.equals("-INFINITY")) {
25512551 makeInf(true);
25522552 return true;
25532553 }
846846 EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-1e-99999").isNegZero());
847847
848848 EXPECT_EQ(2.71828, convertToDoubleFromString("2.71828"));
849 }
850
851 TEST(APFloatTest, fromToStringSpecials) {
852 auto roundTrip = [] (const char* str) {
853 return convertToString(convertToDoubleFromString(str), 0, 3).c_str();
854 };
855 EXPECT_STREQ("+Inf", roundTrip("+Inf"));
856 EXPECT_STREQ("+Inf", roundTrip("INFINITY"));
857 EXPECT_STREQ("+Inf", roundTrip("inf"));
858 EXPECT_STREQ("-Inf", roundTrip("-Inf"));
859 EXPECT_STREQ("-Inf", roundTrip("-INFINITY"));
860 EXPECT_STREQ("-Inf", roundTrip("-inf"));
861 EXPECT_STREQ("NaN", roundTrip("NaN"));
862 EXPECT_STREQ("NaN", roundTrip("nan"));
863 EXPECT_STREQ("NaN", roundTrip("-NaN"));
864 EXPECT_STREQ("NaN", roundTrip("-nan"));
865849 }
866850
867851 TEST(APFloatTest, fromHexadecimalString) {