mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Handle '.' correctly in hex float literal parsing.
There were a couple of different loops that were not handling '.' correctly in APFloat::convertFromHexadecimalString; these mistakes could lead to assertion failures and incorrect rounding for overlong hex float literals. Fixes PR16643. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -766,6 +766,8 @@ TEST(APFloatTest, fromDecimalString) {
|
||||
EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-99e99999").isInfinity());
|
||||
EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "1e-99999").isPosZero());
|
||||
EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-1e-99999").isNegZero());
|
||||
|
||||
EXPECT_EQ(2.71828, convertToDoubleFromString("2.71828"));
|
||||
}
|
||||
|
||||
TEST(APFloatTest, fromHexadecimalString) {
|
||||
@@ -849,7 +851,10 @@ TEST(APFloatTest, fromHexadecimalString) {
|
||||
EXPECT_EQ(1.0625, APFloat(APFloat::IEEEdouble, "0x1.1p0").convertToDouble());
|
||||
EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "0x1p0").convertToDouble());
|
||||
|
||||
EXPECT_EQ(2.71828, convertToDoubleFromString("2.71828"));
|
||||
EXPECT_EQ(convertToDoubleFromString("0x1p-150"),
|
||||
convertToDoubleFromString("+0x800000000000000001.p-221"));
|
||||
EXPECT_EQ(2251799813685248.5,
|
||||
convertToDoubleFromString("0x80000000000004000000.010p-28"));
|
||||
}
|
||||
|
||||
TEST(APFloatTest, toString) {
|
||||
|
Reference in New Issue
Block a user