If the power of 5 is exact, and the reciprocal exact, the error is zero not one half...
authorNeil Booth <neil@daikokuya.co.uk>
Sat, 13 Oct 2007 03:34:08 +0000 (03:34 +0000)
committerNeil Booth <neil@daikokuya.co.uk>
Sat, 13 Oct 2007 03:34:08 +0000 (03:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42950 91177308-0d34-0410-b5e6-96231b3b80d8

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