Skip to content

Commit 12f2ee0

Browse files
jfbastientkoeppe
authored andcommitted
[atomics.types.operations] Clarify compare_exchange note
We now have explicit floating-point specializations for atomic. We had cmpxchg for them before, but people are now looking at increased usage and are confused about what the behavior is for `-0.` with `0.`, as well as NaNs. I propose clarifying the note to make this extra clear. This is a note and is therefore purely editorial, and would be a waste of SG1's time.
1 parent f39be10 commit 12f2ee0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

source/atomics.tex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,11 @@
931931
\begin{note} The \tcode{memcpy} and \tcode{memcmp} semantics of the compare-and-exchange
932932
operations may result in failed comparisons for values that compare equal with
933933
\tcode{operator==} if the underlying type has padding bits, trap bits, or alternate
934-
representations of the same value.\end{note}
934+
representations of the same value. Notably, on implementations conforming to
935+
ISO/IEC/IEEE 60559, floating-point \tcode{-0.0} and \tcode{+0.0}
936+
will not compare equal with \tcode{memcmp} but will compare equal with \tcode{operator==},
937+
and NaNs with the same payload will compare equal with \tcode{memcmp} but will not
938+
compare equal with \tcode{operator==}.\end{note}
935939
\end{itemdescr}
936940

937941
\rSec2[atomics.types.int]{Specializations for integers}

0 commit comments

Comments
 (0)