Compare and bound numbers

Choose the comparison you need

Sign uses one value and returns −1, 0 or 1. Minimum and maximum use a list of 2–50 values, entered one per line. Clamp uses one value and an ordered lower and upper bound.

Clamping returns the lower bound below the interval, the upper bound above it, and the original value within it. Compatible quantities can be compared; incompatible dimensions fail rather than being silently converted to plain numbers.

Worked example: clamp 12 to [0,10]

The interval has lower bound 0 and upper bound 10. Since 12 exceeds 10, the clamped result is 10. A value of 4 would stay 4.

For the list 4, −2, 9, the minimum is −2 and the maximum is 9. Sign(0) is 0.

Load example fills the form without calculating. Choose its primary action to work it out.

Sources and related calculators

The method and worked example here are original. Sources describe the underlying mathematics or notation; calculation choices and limits are in the precision and syntax guide.