Equality with Double.NaN

Posted by chris on Stack Overflow See other posts from Stack Overflow or by chris
Published on 2009-02-17T19:01:50Z Indexed on 2010/05/24 14:51 UTC
Read the original article Hit count: 330

Filed under:
|
|

I have the following code...

if (Price_Foreign != Double.NaN)
{
   output.Append(spacer);
   output.Append(String.Format("{0,-10:C} USD",Price_Foreign));
}

Which outputs:

NaN USD

What gives?

I'm using Double.NaN to indicate that the value doesn't exist, and shouldn't be output.

© Stack Overflow or respective owner

Related posts about c#

Related posts about equality