MIN¶
Returns the smaller of two inputs.
Signature¶
┌─────────┐
IN1 ─┤ │
│ MIN ├─ OUT
IN2 ─┤ │
└─────────┘
FUNCTION MIN : ANY
VAR_INPUT
IN1 : ANY;
IN2 : ANY;
END_VAR
END_FUNCTION
The return type matches the input type. MIN accepts SINT,
INT, DINT, LINT, USINT, UINT, UDINT, ULINT,
REAL, LREAL. Both inputs must share the same type.
Inputs
Name |
Type |
Description |
|---|---|---|
|
|
The first value to compare. |
|
|
The second value to compare. |
Outputs
Name |
Type |
Description |
|---|---|---|
Return value |
|
The smaller of IN1 and IN2. If both inputs are equal, returns that value. Same type as the inputs. |
Description¶
Returns the smaller of IN1 and IN2. If both inputs are equal, the function returns that value.
Example¶
result := MIN(10, 20); (* result = 10 *)
result := MIN(-5, 3); (* result = -5 *)
See Also¶
References¶
IEC 61131-3 §2.5.1.5.5