aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2007-10-13 03:34:08 +0000
committerNeil Booth <neil@daikokuya.co.uk>2007-10-13 03:34:08 +0000
commitd1a23d573d5408be1cf52358fe03df0bfa07e16e (patch)
treef6f01038d06c777ab8858fb646b1f7d133de8fb3 /lib/Support/APFloat.cpp
parente765f8ed1a00082961aed4465dc2a8d86e045d31 (diff)
If the power of 5 is exact, and the reciprocal exact, the error is zero not one half-ulps. This prevents an infinite loop in rare cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42950 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r--lib/Support/APFloat.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index 65ec785725..a4c1affb7a 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -1947,7 +1947,7 @@ APFloat::roundSignificandWithExponent(const integerPart *decSigParts,
excessPrecision = calcSemantics.precision;
}
/* Extra half-ulp lost in reciprocal of exponent. */
- powHUerr = 1 + powStatus != opOK;
+ powHUerr = (powStatus == opOK && calcLostFraction == lfExactlyZero) ? 0: 2;
}
/* Both multiplySignificand and divideSignificand return the