C++ Logo

std-proposals

Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sat, 28 Nov 2026 10:15:00 -0800
On Saturday, 28 November 2026 03:16:32 Pacific Standard Time Aleksandr
Povaliaev via Std-Proposals wrote:
> It is not in accordance with what Mr. Knuth told us at the university :D,
> since there is always an error - and in practice, we should always take it
> into account: fabs(float1 - float2) <= error1 + error2.

No, it shouldn't.

When retrieving elements from a container, we *want* exact precision and we
want NaNs to compare equal (haven't checked if the implementation does that).
Fuzzed results are for other contexts.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-11-28 18:15:08