If the power of 5 is exact, and the reciprocal exact, the error is zero not one half...
[oota-llvm.git] / lib / Support / APFloat.cpp
index 65ec785725576b8d813108ed1c889562919726d7..a4c1affb7a3759a1f793f1cff8f016d78cd766ca 100644 (file)
@@ -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