JuliaLang/julia — pull request #5256 by lindahua (2013-12-29 18:32:32+00:00)
Title: Modified implementation of maximum & minimum with improved efficiency.

With this modified implementation, we don't have to check ``(v != v)`` within inner loops.

Rationales:

1. NaN only exist for floating points -- so only have to deal with them in methods specialized to floating point.

2. Once a non-NaN value is found, we can then follow the normal routine. Because ``x > v`` (or ``x < v``) is never true when ``x`` is ``NaN``, and therefore, ``v`` won't become ``NaN`` again.

Note: I also added several test cases to ensure the correctness.