3 ms·
Seriously. This is about a million times better.
by matthewmacleod 6y ago
Seriously. This is about a million times better.
- mywittyname 6y agoAbsolutely. With the above implementation, I can see exactly what's going on, with the others, I'm trying to work out potential edge cases.
- brandmeyer 6y agoI prefer the min/max-based definition for the same reason: Its easier to work out the edge cases around NaN and comparisons against NaN.
- cogman10 6y agoNaN always returns false on comparisons. So seems pretty straight forward that this would return NaN if NaN is passed in. That doesn't seem unreasonable. (In fact, that's what happens with the min/max approach).