Skip to manual
gluon

Expression functions

gluon.clamp(value, minimum, maximum)

Keeps a number between a minimum and a maximum.

Model author or developer

Example

CEL
gluon.clamp(12.0, 0.0, 10.0)

This returns 10.0. gluon.clamp(-3.0, 0.0, 10.0) returns 0.0.

Types

The type checker knows it as gluon.clamp(double, double, double) -> double. Call it in any GOL field that takes CEL: a Function, a derived property, a constraint or a policy condition.

Limits

Pass doubles. The minimum is never checked against the maximum: with the bounds swapped it always returns the minimum you passed.

Guard optional inputs with has(). In a policy, an evaluation error denies. An expression that does not parse, runs past 2,000 characters or nests too deeply is GLN-E201, and one whose result has the wrong type is GLN-E202.

See Function, Test and the language guide.

gluon.clamp(value, minimum, maximum) evaluated by Gluon's CEL runtime.
gluon.clamp(value, minimum, maximum) evaluated by Gluon's CEL runtime.