Description: Set Value Minimum and Maximum. This function returns a value that is limited both on the high and low ranges.
Returns: Numeric
Usage: Script or Steady State.
Format: Limit(X, Low, High)
Parameters: X { numeric } { required } { no default }
Any numeric expression that gives the value to limit.
Low { numeric } { required } { no default }
Any numeric expression giving the lower limit for the value X.
High { numeric } { required } { no default }
Any numeric expression giving the upper limit for the value X.
Comments: This function performs the same operation as Min(High, Max(Low, X)) but is simpler to write and requires less memory. If the value exceeds one of the limits, the function returns that limit; otherwise, the value is returned unchanged. If Low is greater than High, the value for High is returned. If any of the parameters is invalid, the function returns invalid.
Examples:
a = Limit(123.4, 0, 100);
b = Limit(-2.6, 0, 100);
c = Limit(36.7, 0, 100);
d = Limit(36.7, Invalid, 100);
The values for a, b, c, and d are 100, 0, 36.7 and invalid, respectively.
See Also: