Fix check for valid floats. Also use and HUGE_VALF instead

of std::numeric_limits, because they work in more platforms.

llvm-svn: 18593
This commit is contained in:
Alkis Evlogimenos 2004-12-07 06:46:50 +00:00
parent 784a0dcbd0
commit 2b91842092
1 changed files with 1 additions and 10 deletions

View File

@ -21,7 +21,6 @@
#include "llvm/ADT/StringExtras.h"
#include <algorithm>
#include <iostream>
#include <limits>
using namespace llvm;
ConstantBool *ConstantBool::True = new ConstantBool(true);
@ -443,15 +442,7 @@ bool ConstantFP::isValueValidForType(const Type *Ty, double Val) {
// TODO: Figure out how to test if a double can be cast to a float!
case Type::FloatTyID:
return
(std::numeric_limits<double>::has_infinity &&
std::numeric_limits<float>::has_infinity &&
Val == std::numeric_limits<double>::infinity()) ||
(std::numeric_limits<double>::has_quiet_NaN &&
std::numeric_limits<float>::has_quiet_NaN &&
Val == std::numeric_limits<double>::quiet_NaN()) ||
(Val >= -std::numeric_limits<float>::max() &&
Val <= std::numeric_limits<float>::max());
return isinf(Val) || isnan(Val) || (Val >= -HUGE_VALF && Val <= HUGE_VALF);
case Type::DoubleTyID:
return true; // This is the largest type...