Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32_LowLevel🞂ConstrainFunction

Constrain

Constrains a numeric value to a specified lower and upper boundary range.

Declarations ​

pascal
function Constrain(const Value, Lo, Hi: Integer): Integer; overload;
function Constrain(const Value, Lo, Hi: Single): Single; overload;
Overload Details

Overload 1 ​

pascal
function Constrain(const Value, Lo, Hi: Integer): Integer; overload;

Constrains an Integer value to [Lo..Hi].

ParameterTypeDescription
ValueIntegerThe integer value to constrain.
LoIntegerLower boundary.
HiIntegerUpper boundary.
TypeDescription
IntegerValue clamped to range [Lo..Hi].

Overload 2 ​

pascal
function Constrain(const Value, Lo, Hi: Single): Single; overload;

Constrains a Single floating-point value to [Lo..Hi].

ParameterTypeDescription
ValueSingleThe floating-point value to constrain.
LoSingleLower boundary.
HiSingleUpper boundary.
TypeDescription
SingleValue clamped to range [Lo..Hi].

Description ​

Constrain restricts Value to lie within the closed range [Lo..Hi]. If Value is less than Lo, Lo is returned; if Value is greater than Hi, Hi is returned; otherwise Value is returned unchanged.

See also ​