|
|
|
|
|
by thaumasiotes
2126 days ago
|
|
No, it breaks the ordering requirements. NaN compares greater than and less than every number. You can say that a call to max should return NaN if any argument is NaN, but you can't say the same about sorting. (For one thing... sorting an array doesn't return a scalar value.) Sorting is done with comparisons, and what happens if a NaN gets into the list of values will depend on which specific comparisons happen to be done. |
|