float / nan - make use of

I was wondering if I could make use of the ability to have floats being an invalid number?

How would I set a float to be an invalid number (without doing divide by zero or other intentionally dodgy sum)?

i was thinking of using it as a kind of null value... as far as i am aware this is the only non-number value of a float, right?
I am sorry. I don't understand what that is?
1
2
3
4
5
6
 #include <iostream>
#include<limits>
int main(){
float f = std::numeric_limits<float>::quiet_NaN();
std::cout<<f;
} 
Topic archived. No new replies allowed.