Implement functions min() and max() (#12772)

Change-Id: I68739508e13fb46a9ab4063d31251b4c730a6f12