C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Q: invariant for unordered_set and unordered_map "hash" and "comp" argument

From: Paul Caprioli <paul_at_[hidden]>
Date: Fri, 27 Nov 2026 19:48:00 +0100 (CET)
> 0.0 == -0.0 (On x86)

And on any machine supporting IEEE Std 754-2019 floating-point
arithmetic. "Comparisons shall ignore the sign of zero."

> two NaNs will compare as not equal, but would (could?) memcmp as
> equal.

Yes, "Every NaN shall compare unordered with everything, including
itself."

Could. NaNs have a payload. For example, in single precision, both
0x7FC00000 and 0x7FC0DEAD are NaN.


            S ---E8--- ----------F23----------
    Binary: 0 11111111 10000000000000000000000

            S ---E8--- ----------F23----------
    Binary: 0 11111111 10000001101111010101101

Received on 2026-11-27 18:48:06