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

- 08-27-2005Downninhow to set value equal to infinity
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. - 08-27-2005Salem
- 08-27-2005Zach L.
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. - 08-27-2005grumpy
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. - 08-27-2005Zach L.
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 - 08-28-2005dwks
I think there are functions (in C99) like nan() and setnan().