I typed `drop if var>50`, and STATA dropped, without me realizing it, rows with missing `var`.
In fact, "Stata codes missing values (., .a, .b, .c, ..., .z) larger than any nonmissing values, so, literally, x >1000 is true" (source).
This behaviour is in direct violation of IEEE 754.
The standard provides that comparing NaN with whatever else ALWAYS RETURN FALSE (and not true as STATA is doing).
As specified in chapter 5.11 of the standard, NaN always compare unordered with everything:
In fact:
Moreover, if the operator is signaling, an error must be thrown when one of the operand is NaN:
In fact, "Stata codes missing values (., .a, .b, .c, ..., .z) larger than any nonmissing values, so, literally, x >1000 is true" (source).
This behaviour is in direct violation of IEEE 754.
The standard provides that comparing NaN with whatever else ALWAYS RETURN FALSE (and not true as STATA is doing).
As specified in chapter 5.11 of the standard, NaN always compare unordered with everything:
unordered arises when at least one operand is a NaN. Every NaN shall compare unordered with everything, including itself
When NaNs are present, operands have the unordered relation, so trichotomy does not apply.
The Signaling predicates in Table 5.1 signal the invalid operation exception on quiet NaN operands to warn of potential incorrect behavior of programs written assuming trichotomy
Comment