[llvm-commits] CVS: llvm/lib/Support/APInt.cpp

Chris Lattner clattner at apple.com
Tue Feb 20 11:38:37 PST 2007


On Feb 20, 2007, at 11:13 AM, Evan Cheng wrote:
> Hi Reid,
> This breaks the build for me.
>
> $ make ENABLE_OPTIMIZED=1 -j2
> make[1]: Nothing to be done for `all'.
> llvm[1]: Compiling Annotation.cpp for Release build
> llvm[1]: Compiling APInt.cpp for Release build
> APInt.cpp:841: error: floating constant exceeds range of 'float'
> APInt.cpp:843: error: floating constant exceeds range of 'float'

Okay, how about just using something like (1e300 * 1e300), which will  
constant fold to inf?

-Chris

> Evan
>
> On Feb 20, 2007, at 10:29 AM, Reid Spencer wrote:
>
>>
>>
>> Changes in directory llvm/lib/Support:
>>
>> APInt.cpp updated: 1.22 -> 1.23
>> ---
>> Log message:
>>
>> Use INFINITY macro from math.h instead of constructing hex floating
>> point
>> constants (avoids warnings).
>>
>>
>> ---
>> Diffs of the changes:  (+3 -2)
>>
>>  APInt.cpp |    5 +++--
>>  1 files changed, 3 insertions(+), 2 deletions(-)
>>
>>
>> Index: llvm/lib/Support/APInt.cpp
>> diff -u llvm/lib/Support/APInt.cpp:1.22 llvm/lib/Support/APInt.cpp:
>> 1.23
>> --- llvm/lib/Support/APInt.cpp:1.22	Tue Feb 20 02:51:03 2007
>> +++ llvm/lib/Support/APInt.cpp	Tue Feb 20 12:29:12 2007
>> @@ -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 @@
>>    // 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
>>
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list