diff options
author | Serguei Katkov <serguei.katkov@azul.com> | 2017-10-19 11:16:03 +0000 |
---|---|---|
committer | Serguei Katkov <serguei.katkov@azul.com> | 2017-10-19 11:16:03 +0000 |
commit | 90ee44d185a3e9cafa156ec58901adc73931de16 (patch) | |
tree | beefffd1da13ce5e88335772eb46cf0d618aeeea /lib/Support/APFloat.cpp | |
parent | 24177b8a151a8538682e1ce4d7485ef55b449e11 (diff) | |
download | llvm-90ee44d185a3e9cafa156ec58901adc73931de16.tar.gz |
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().
Reviewers: sberg, bogner, majnemer, timshen, rnk, skatkov, gottesmm, bkramer, scanon
Reviewed By: skatkov
Subscribers: apilipenko, reames, llvm-commits
Differential Revision: https://reviews.llvm.org/D38030
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r-- | lib/Support/APFloat.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index f835bd1fbd23..cc77672633ef 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -2543,12 +2543,12 @@ IEEEFloat::convertFromDecimalString(StringRef str, roundingMode rounding_mode) { } bool IEEEFloat::convertFromStringSpecials(StringRef str) { - if (str.equals("inf") || str.equals("INFINITY")) { + if (str.equals("inf") || str.equals("INFINITY") || str.equals("+Inf")) { makeInf(false); return true; } - if (str.equals("-inf") || str.equals("-INFINITY")) { + if (str.equals("-inf") || str.equals("-INFINITY") || str.equals("-Inf")) { makeInf(true); return true; } |