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.
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.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
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.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
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
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
I think there are functions (in C99) like nan() and setnan().
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.