if TEST is a variable, then how can i set this variable,Test, equal to infinity.
When i have already set it to infinity, how can i check it that it is already set to infinity.
Printable View
if TEST is a variable, then how can i set this variable,Test, equal to infinity.
When i have already set it to infinity, how can i check it that it is already set to infinity.
http://www.roguewave.com/support/doc...s.html#idx1018
Another way of doing it using numeric_limits. See the infinity() and quiet_NaN() member functions.
numeric_limits does not work in general; IEEE floating point formats support the notion of "not a number" (NaN) or of infinity. Other floating point formats do not. The infinity() and quiet_NaN() members numeric_limits have no effect if your compiler supports a format that doesn't support them.
The general approach if you want to represent infinity and other concepts that are not supported universally by floating point formats is to write your own class which manages (conceptually) a floating point value and a set of boolean flags.
Presumably, if you are looking for infinity and NaN, then you ought to use the bool members of numeric_limits that tell you if the type has them as well... doing otherwise does not make sense.
Cheers
I think there are functions (in C99) like nan() and setnan().