Use INFINITY macro from math.h instead of constructing hex floating point
authorReid Spencer <rspencer@reidspencer.com>
Tue, 20 Feb 2007 18:29:12 +0000 (18:29 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Tue, 20 Feb 2007 18:29:12 +0000 (18:29 +0000)
constants (avoids warnings).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34452 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APInt.cpp

index ad728e9f6a5b35b98777a4e2f0bd2e8fcf12ed30..51a1c147f0ae220aded7633291260e21466a7d0c 100644 (file)
@@ -17,6 +17,7 @@
 #include "llvm/Support/MathExtras.h"
 #include <cstring>
 #include <cstdlib>
+#include <cmath>
 using namespace llvm;
 
 // A utility function for allocating memory, checking for allocation failures,
@@ -837,9 +838,9 @@ double APInt::roundToDouble(bool isSigned) const {
   // Return infinity for exponent overflow
   if (exp > 1023) {
     if (!isSigned || !isNeg)
-      return double(0x0.0p2047L); // positive infinity
+      return double(INFINITY); // positive infinity
     else 
-      return double(-0x0.0p2047L); // negative infinity
+      return double(-INFINITY); // negative infinity
   }
   exp += 1023; // Increment for 1023 bias