Anyway, you just use a bitwise comparison for float and double (as it is currently implemented in stdc++ library), or use fabs(float1 - float2) <= error1 + error2. There is no any other option :D
But as I wrote, a tree of segments (where the width of any particular segment represents error deviation) structure is more applicable to such kind of "fuzzy-logic".
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.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals