http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56367
Bug #: 56367 Summary: unordered containers behave badly with NaN Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ch...@bubblescope.net After reading about a similar problem in Python, I decided to try putting multiple NaNs into an unordered_set<double>, and found that I can insert multiple NaNs. This is not surprising, as NaNs compare as not equal. I'm not sure what we should do about this. Based on my reading of the standard putting NaNs in unordered containers isn't legal, but we could add checks in debug mode. Certainly, users ending up with NaNs in containers causes all kinds of problems (although of course there are other standard issues with comparing doubles for equality anyway).