mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
Fix two APFloat bugs in converting hexadecimal constants.
llvm-svn: 79540
This commit is contained in:
parent
6ec8176e22
commit
9ad4b47cec
@ -2153,7 +2153,7 @@ APFloat::convertFromHexadecimalString(const StringRef &s,
|
||||
integerPart hex_value;
|
||||
|
||||
if(*p == '.') {
|
||||
assert(dot == 0);
|
||||
assert(dot == s.end());
|
||||
dot = p++;
|
||||
}
|
||||
|
||||
@ -2190,7 +2190,7 @@ APFloat::convertFromHexadecimalString(const StringRef &s,
|
||||
int expAdjustment;
|
||||
|
||||
/* Implicit hexadecimal point? */
|
||||
if(!dot)
|
||||
if (dot == s.end())
|
||||
dot = p;
|
||||
|
||||
/* Calculate the exponent adjustment implicit in the number of
|
||||
|
@ -60,6 +60,8 @@ TEST(APFloatTest, fromString) {
|
||||
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1234").convertToDouble());
|
||||
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1234").convertToDouble());
|
||||
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0.p1234").convertToDouble());
|
||||
EXPECT_EQ(1.0625, APFloat(APFloat::IEEEdouble, "0x1.1p0").convertToDouble());
|
||||
EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "0x1p0").convertToDouble());
|
||||
|
||||
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, StringRef("0e1\02", 3)).convertToDouble());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user