diff options
author | Serguei Katkov <serguei.katkov@azul.com> | 2017-12-19 04:27:39 +0000 |
---|---|---|
committer | Serguei Katkov <serguei.katkov@azul.com> | 2017-12-19 04:27:39 +0000 |
commit | 768d6dd08783440606da83dac490889329619898 (patch) | |
tree | 0efa280bf90c8da024b5d111724f613f01055f2a /llvm/unittests/ADT/StringRefTest.cpp | |
parent | 63a328c30c8d02f79944f1496356bf13d2a2ac12 (diff) | |
download | bcm5719-llvm-768d6dd08783440606da83dac490889329619898.tar.gz bcm5719-llvm-768d6dd08783440606da83dac490889329619898.zip |
Fix APFloat from string conversion for Inf
The method IEEEFloat::convertFromStringSpecials() does not recognize
the "+Inf" and "-Inf" strings but these strings are printed for
the double Infinities by the IEEEFloat::toString().
This patch adds the "+Inf" and "-Inf" strings to the list of recognized
patterns in IEEEFloat::convertFromStringSpecials().
Re-landing after fix.
Reviewers: sberg, bogner, majnemer, timshen, rnk, skatkov, gottesmm, bkramer, scanon, anna
Reviewed By: anna
Subscribers: mkazantsev, FlameTop, llvm-commits, reames, apilipenko
Differential Revision: https://reviews.llvm.org/D38030
llvm-svn: 321054
Diffstat (limited to 'llvm/unittests/ADT/StringRefTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/StringRefTest.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp index 0684afe678f..0e0b5957f02 100644 --- a/llvm/unittests/ADT/StringRefTest.cpp +++ b/llvm/unittests/ADT/StringRefTest.cpp @@ -875,7 +875,12 @@ struct GetDoubleStrings { {"0.0", false, false, 0.0}, {"-0.0", false, false, -0.0}, {"123.45", false, true, 123.45}, - {"123.45", true, false, 123.45}}; + {"123.45", true, false, 123.45}, + {"1.8e308", true, false, std::numeric_limits<double>::infinity()}, + {"1.8e308", false, true, std::numeric_limits<double>::infinity()}, + {"0x0.0000000000001P-1023", false, true, 0.0}, + {"0x0.0000000000001P-1023", true, false, 0.0}, + }; TEST(StringRefTest, getAsDouble) { for (const auto &Entry : DoubleStrings) { |