I think we should (1) issue a warning when Math.nan is used inside a case and (2) make sure that switch (Math.nan) does not match any case.
I believe that the compiler should:
- Special case NaN if there's an explicit case-label with NaN.
- Map NaN to the default label (if any) otherwise.
This should be rather simple to do with a minor modification of switch_svalue_cmpfun().
/grubba