Now what If I told you that none of these hold true for
Set<Double>, and consequently
How can this be, given that both,
Hashable(and therefor also
Equatable), one of the (quite literally) key-requirements of
Yep, there’s indeed more than one
NaN: a total of
8388606of them in
Floatalone, to be specific. And even more of them are to be found in
There’s WIP to make floats Equatable and Comparable using level 2 comparison (so NaN == NaN, NaN < number, -0 != 0)
That way you get sound behavior when floats end up in generic containers, but the expected level-1 semantics working concretely with floats.
Stay up-to-date by subscribing to the Comments RSS Feed for this post.