32.18.2.3 Explanation of the GT Instruction
The GT instruction is a compare instruction. The GT instruction
compares S1 with S2. If the result of the comparison is S1 > S2,
the instruction passes power. Be careful when comparing real
values. For example, if the operand value is 2.000000000001, it is
still greater than 2. When using the GT instruction, an error will
occur if the variables specified in operands S1 and S2 are not the
same type. Designate the same variable type in all operands S1 and
S2.
Refer to the following for specifying a constant.
When operand S1 or S2 is an integer
constant
When entering hexadecimal values in operands
S1 or S2
When 0x (zero and lower case "x") is input, the following values
become hexadecimal values.
When entering float constants in operands S1
or S2
When 0f (zero and lower case "f") is input, the following values
are interpreted as float values.
When entering real constants in operands S1
or S2
When 0r (zero and lower case "r") is input, the following values
are interpreted as real values.
When Comparing Data in a Specified Array
(Integer Variable Array)
Specify the array using Data [0] or Data [N] (N indicates an
integer variable).
When operands S1 and S2 specify the entire array, an error will
occur even if the specified variables are the same type.
Program Example
GT
Compares integer variables and outputs the result in D1.
-
Data_A and the operation result are compared to
determine whether Data_A is greater than the operation result. If
the result of the GT instruction is S1 > S2, the GT instruction
passes power. Then the instruction to the right of the GT
instruction is executed. In the above diagram, it's the MOV
instruction.
|