Re: Interesting behavior of double.NaN
John Brett <[email protected]> Mon, 23 Mar 2009 15:13:32 +0000
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
> Hello, > > This interesting behavior is by design. From the documentation: > > ---------------------------- > Double.NaN Field > > Represents a value that is not a number (NaN). This field is constant. > > Use IsNaN<http://msdn.microsoft.com/en-us/library/system.double.isnan.aspx> to determine whether a value is not a number. It is not possible to determine whether a value is not a number by comparing it to another value equal to NaN. Hi, As you say, this is by design. Aside from this, however, you need to be careful testing floating point numbers for equality. http://docs.sun.com/source/806-3568/ncg_goldberg.html (reprint) John =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives