summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitc799fe9ed9ad1a713f516a037f7684287848ac2e (patch)
tree8888ac339c412dc0e0865955cada7ea57933db86 /llvm/lib/Support/APFloat.cpp
parentf86204baf42d0170904e1bf0705365ba8ee401ca (diff)
downloadbcm5719-llvm-c799fe9ed9ad1a713f516a037f7684287848ac2e.tar.gz
bcm5719-llvm-c799fe9ed9ad1a713f516a037f7684287848ac2e.zip
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.
llvm-svn: 42950
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 65ec7857255..a4c1affb7a3 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud