I\'m trying to figure out how to assign the value of negative infinity to a float or double variable. It seems that including the standard library limits, I can get the infi
I don't know what compiler your using, but you can use -std::numeric_limits on gcc and MinGw see Infinity-and-NaN. Also I ran the following code on MSVC and it returned true:
double infinity(std::numeric_limits::infinity());
double neg_infinity(-std::numeric_limits::infinity());
double lowest(std::numeric_limits::lowest());
bool lower_than_lowest(neg_infinity < lowest);
std::cout << "lower_than_lowest: " << lower_than_lowest << std::endl;
However, it maybe worthwhile considering using lowest in your application instead of negative infinity as it's likely to result in a more portable solution.