Date: Sat, 28 Nov 2026 21:21:35 +0300
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".
сб, 28 нояб. 2026 г. в 21:15, Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]>:
> 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_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
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".
сб, 28 нояб. 2026 г. в 21:15, Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]>:
> 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_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2026-11-28 18:21:49
