Clamp a number into the inclusive range [min, max]. null or
undefined bounds read as -Infinity / +Infinity respectively, so
either side can be left open. NaN value propagates and is returned
unchanged. When the bounds invert (min > max after coercion), min
wins and the returned value is min.