Ref #14313: NaN detection

Per https://github.com/jquery/jquery/commit/ceb5b4c9a30f47bcec2380f972ce09cfea532f8b#commitcomment-4004722 and https://github.com/jquery/contribute.jquery.org/issues/54#issuecomment-23863038, better code and comments for `NaN` handling.

```
   raw     gz Compared to 1.x-master @ 9035cab8c8574404c9eaeb795d0d87f4df772d45
  +156    +66 dist/jquery.js                                                   
   -32    -20 dist/jquery.min.js
```