Looking at the SSE operators
CMPORDPS - ordered compare packed singles
CMPUNORDPS - unordered compare packed singles
What do ordered and unordered mean? I looked for equivalent instructions in the x86 instruction set, and it only seems to have unordered (FUCOM).
An ordered comparison checks if neither operand is
NaN. Conversely, an unordered comparison checks if either operand is aNaN.This page gives some more information on this:
The idea here is that comparisons with
NaNare indeterminate. (can’t decide the result) So an ordered/unordered comparison checks if this is (or isn’t) the case.Result:
Ordered return true if the operands are comparable (neither number is NaN):
1.0and1.0givestrue.NaNand1.0givesfalse.NaNandNaNgivesfalse.Unordered comparison is the exact opposite:
1.0and1.0givesfalse.NaNand1.0givestrue.NaNandNaNgivestrue.