aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-01-31 18:34:01 +0000
committerDale Johannesen <dalej@apple.com>2008-01-31 18:34:01 +0000
commitd8a3d9e85eedc5c898ef73e835292dba71cfdd4c (patch)
treeb68b75ecd1b6989412666cc71dffa637b085bee6 /lib/Support/APFloat.cpp
parenta7fbaf8f0aa886cf73e671a64ae3194a688e506b (diff)
downloadexternal_llvm-d8a3d9e85eedc5c898ef73e835292dba71cfdd4c.zip
external_llvm-d8a3d9e85eedc5c898ef73e835292dba71cfdd4c.tar.gz
external_llvm-d8a3d9e85eedc5c898ef73e835292dba71cfdd4c.tar.bz2
Chris' change to print an approximation to long doubles
exposed a bug in APFloat's long double->double conversion of NaNs. Broke several things in the ieee part of gcc testsuite. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r--lib/Support/APFloat.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index 04e9914..3de709c 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -1712,6 +1712,8 @@ APFloat::convert(const fltSemantics &toSemantics,
fs = normalize(rounding_mode, lostFraction);
} else if (category == fcNaN) {
int shift = toSemantics.precision - semantics->precision;
+ // Do this now so significandParts gets the right answer
+ semantics = &toSemantics;
// No normalization here, just truncate
if (shift>0)
APInt::tcShiftLeft(significandParts(), newPartCount, shift);
@@ -1721,7 +1723,6 @@ APFloat::convert(const fltSemantics &toSemantics,
// does not give you back the same bits. This is dubious, and we
// don't currently do it. You're really supposed to get
// an invalid operation signal at runtime, but nobody does that.
- semantics = &toSemantics;
fs = opOK;
} else {
semantics = &toSemantics;