It looks easy but it isn&#x27;t.<p>The second example causes unexpected behavior (and probably ub later) if: min + step &gt; MIN_TYPE_MAX<p>The last example causes undefined behavior if: max - min &lt; step - 1.