# math.clamp Returns `value` if it lies between `min` and `max` inclusive, otherwise the nearer bound. A range with `min` greater than `max` is an error rather than a guess. The common one-liner `max(min, min(value, max))` quietly returns `min` for every input when the bounds are swapped, which hides the bug that swapped them. Integers only, so it is exact for amounts in minor units, basis points and counts. For money of one currency use `money.compare`, which checks the currencies as well.