From: Neil Booth Date: Sat, 13 Oct 2007 03:34:08 +0000 (+0000) Subject: If the power of 5 is exact, and the reciprocal exact, the error is zero not one half... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=d1a23d573d5408be1cf52358fe03df0bfa07e16e;p=oota-llvm.git 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 --- diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index 65ec7857255..a4c1affb7a3 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