How NaN Breaks Python and Lua Language Design Assumptions
Two Case Studies of NaN
I discovered two surprising cases where IEEE-754 NaN values break implicit assumptions in programming language design. In Python, list equality checks fail because NaN does not equal itself, violating reflexive rules. In Lua, numerical for-loops behave unpredictably when NaN is used as a limit or step, leaking internal comparison logic. These oversights show how weird NaN behavior can silently corrupt language semantics.
"NaN is weird, and that means other things behave weirdly with it."