Hello Jan!
Thanks for replying.

My reading is that it's not a requirement.
NaN seems to be supported indeed, and that's possibly the motivation.
Right, the semantic requirements of std::equality_comparable concept
are written in such a way that one might conclude that reflexivity in not required,
and thus floating point types (floatdouble, etc.) do model std::equality_comparable.

In that case, I would argue that the name of the concept is wrong / misleading,
because it intends to represent types providing operator ==, which implements partial equality,
that is, it should have been named std::partially_equality_comparable, not std::equality_comparable.

The Wikipedia article describing partial equivalence relation explicitly states this fact:
In mathematics, a partial equivalence relation is a homogeneous binary relation that is symmetric and transitive. 
If the relation is also reflexive, then the relation is an equivalence relation.

This article also points out that equality of IEEE floating point values is a partial equality, due to NaN:
The IEEE 754:2008 standard for floating-point numbers defines an "EQ" relation for floating point values. 
This predicate is symmetric and transitive, but is not reflexive because of the presence of NaN values that are not EQ to themselves.

Thank you, Mateusz Zych

On Wed, Jul 30, 2025 at 8:51 AM Jan Schultke <janschultke@googlemail.com> wrote:
Correction: I've misremembered something.

x != x

is true for NaN, so NaN seems to be supported indeed, and that's
possibly the motivation.

On Wed, 30 Jul 2025 at 07:48, Jan Schultke <janschultke@googlemail.com> wrote:
>
> > This got me wondering whether reflexivity
> > is a semantic requirement of std::equality_comparable or not?
>
> My reading is that it's not a requirement.
> To model weakly-equality-comparable-with<T,U>,
> with lvalues t and u of types T and U,
> the following requirement has to be met:
>
> > bool(t != u) == !bool(t == u).
>
> See https://eel.is/c++draft/concept.equalitycomparable
>
> For a value such as NaN, this is "false == true" because all
> comparisons are false. If a value was equal to all other values but
> not to itself, then equality wouldn't be transitive, so that also
> wouldn't work. HOWEVER, if == always yields false and != always yields
> true, then it seems like all the requirements are met.
>
> I don't know what the motivation is, seeing that NaN is not supported,
> but I suppose it's a slightly more minimalistic requirement if we
> allow values that are equal to nothing, not even themselves, even
> though I cannot think of a good use case.