Functions Index :: C :: Clamp

[<< up one level]

Module:

numeric :: core

Definition:

Clamp(val x, val low_limit, val high_limit)

Description:

Returns either x unchanged or one of the low_limit / high_limit limiting values specified.

In other words it clamps x inside the interval [low_limit..high_limit].

Examples:

v = 2.8

w1 = Clamp(v, 2, 3) # w1 == 2.8

w2 = Clamp(v, 1, 2) # w2 == 2.0

w3 = Clamp(v, 3, 4) # w3 == 3.0

 

[<< top]