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 | 4f7d5ef2260f20f9773810b05eb085d97ddfc7c1 (patch) | |
tree | 21be2bbc08addbefcae9d6610b7cc6de73a4c15a /llvm/lib/Support/APFloat.cpp | |
parent | 7bf71008aa69e035832d610d6a658f8f09e1f97d (diff) | |
download | bcm5719-llvm-4f7d5ef2260f20f9773810b05eb085d97ddfc7c1.tar.gz bcm5719-llvm-4f7d5ef2260f20f9773810b05eb085d97ddfc7c1.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().
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
llvm-svn: 316156
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r-- | llvm/lib/Support/APFloat.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index f835bd1fbd2..cc77672633e 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/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; } |