comparing double values in C++
<p>I have following code for double comparision. Why I am getting not equal when I execute?</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include &lt;limits&gt; 

bool AreDoubleSame(double dFirstVal, double dSecondVal)
{
    return std::fabs(dFirstVal - dSecondVal) &lt; std::numeric_limits&lt;double&gt;::epsilon();
}


int main()
{
double dFirstDouble = 11.304;
double dSecondDouble = 11.3043;

if(AreDoubleSame(dFirstDouble , dSecondDouble ) )
{
std::cout &lt;&lt; "equal" &lt;&lt; std::endl;
}
else
{
std::cout &lt;&lt; "not equal" &lt;&lt; std::endl;
}
}
</code></pre>
