Fix misuses of std::numeric_limits<T>::min.
Merge pull request #405 from yangyanli/fix_min_misuses

Fix misuses of std::numeric_limits<T>::min.