Skip to content

clip

relationalai.semantics.std.math
clip(value: NumberValue, lower: NumberValue, upper: NumberValue) -> Expression

Clip (clamp) a value to a range.

  • Expression - An Expression computing the clipped value (min(upper, max(lower, value))). Returns Number if the input is Number, or Float if the input is Float.

Clip values to a range:

>>> select(math.clip(Employee.score, 0, 100))
>>> select(math.clip(Temperature.reading, -10, 40))