This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/56367] New: unordered containers behave badly with NaN
- From: "chris at bubblescope dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 17 Feb 2013 19:20:41 +0000
- Subject: [Bug libstdc++/56367] New: unordered containers behave badly with NaN
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: chris@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).