how to know the existance of NAN value in a double variable?
<p>i have issue with comparing NAN value in C++, Visualstudio.
I need to handle Division by Zero in my code.
if i get division by zero, i want to assign NAN to the result.
Check at later point of time, whether result has NAN.
But NAN comparision is failing at later point of time, even though i assign quiet_Nan() as below.</p>

<pre><code>double d = std::numeric_limits&lt;double&gt;::quiet_NaN();
if( d == std::numeric_limits&lt;double&gt;::quiet_NaN())
{
    cout&lt;&lt;" NAN ";
}
else
{
    cout&lt;&lt;" Number";
}
</code></pre>

<p>I know that floating values can't be compared for equality. I tried taking diff between d and quiet_Nan() and tried to compare it with floating number with &lt; operator.
I saw few posts but couldn't get how to compare double value.</p>

<p>how to know the existence of NAN value in a double variable ?</p>
