Simplified notation for max(lb, min(x, ub))?

19 Views Asked by At

Let's say I want to saturate an argument number x to a lower-bound value lb if it is lower than lb and otherwise return x itself. Then I can use max(lb, x). Analogously, I can use min(x, ub) if I have an upper bound ub.

Is there a function f, such that if I write f(lb, x, ub), one understands that the return value is the respective one?

  • lb, if x < lb;
  • ub, if x > ub; and
  • x, otherwise.

Or other notation simpler than writing max(lb, min(x, ub)).