Original Post
Are there any float / double constants for +/- infinity in C++? I haven't found anything useful using google. The only thing I found was IEEE 754 (floating-point standard); It seems 1.0 / 0.0 is defined. The only problem is that when I try declaring a const float as 1.0 / 0.0 (i.e. const float inf = 1.0 / 0.0;) MSVC++ complains about a division by zero, whereas the following code does produce the required results;
float one = 1.0;
float zero = 0.0;
float infy = one / zero;
printf("%f\n", infy);
// prints "1.#INF00"
I need infinite values; I need to compare against them. There's really no way around this unless you'd call flagging certain stuff with bools a way around; this piece of code needs to be fast. So.. any ideas? Have I missed something while googling? There must be constants for this...