Skip to content

Commit

Permalink
[atomics.types.operations] Clarify compare_exchange note
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jfbastien authored and tkoeppe committed Feb 12, 2018
1 parent f39be10 commit 12f2ee0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/atomics.tex
Expand Up @@ -931,7 +931,11 @@
\begin{note} The \tcode{memcpy} and \tcode{memcmp} semantics of the compare-and-exchange
operations may result in failed comparisons for values that compare equal with
\tcode{operator==} if the underlying type has padding bits, trap bits, or alternate
representations of the same value.\end{note}
representations of the same value. Notably, on implementations conforming to
ISO/IEC/IEEE 60559, floating-point \tcode{-0.0} and \tcode{+0.0}
will not compare equal with \tcode{memcmp} but will compare equal with \tcode{operator==},
and NaNs with the same payload will compare equal with \tcode{memcmp} but will not
compare equal with \tcode{operator==}.\end{note}
\end{itemdescr}

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

0 comments on commit 12f2ee0

Please sign in to comment.