[llvm-commits] [llvm] r42950 - /llvm/trunk/lib/Support/APFloat.cpp

Neil Booth neil at daikokuya.co.uk
Fri Oct 12 20:34:08 PDT 2007


Author: neil
Date: Fri Oct 12 22:34:08 2007
New Revision: 42950

URL: http://llvm.org/viewvc/llvm-project?rev=42950&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Support/APFloat.cpp

Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=42950&r1=42949&r2=42950&view=diff

==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Fri Oct 12 22:34:08 2007
@@ -1947,7 +1947,7 @@
           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





More information about the llvm-commits mailing list