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 versions 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.
remove function names in maximum/minimum error messages
Merge pull request #5256 from lindahua/dh/maxmin2

Modified implementation of maximum & minimum with improved efficiency.