get the minimum between two numbers.

this function is faster than Math.min as it uses the ternary conditional operator, which makes it highly JIT optimized.