summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2017-12-19 04:27:39 +0000
committerSerguei Katkov <serguei.katkov@azul.com>2017-12-19 04:27:39 +0000
commit768d6dd08783440606da83dac490889329619898 (patch)
tree0efa280bf90c8da024b5d111724f613f01055f2a /llvm/lib/Support/APFloat.cpp
parent63a328c30c8d02f79944f1496356bf13d2a2ac12 (diff)
downloadbcm5719-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/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index f7fb0cef16b..3489feb93a0 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -2546,12 +2546,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;
}
OpenPOWER on IntegriCloud