This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/56367] New: unordered containers behave badly with NaN


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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]