omron — COM operator

COM operator COM operator Syntax ... COM value ... Function Perform the binary complement operation on a value. Usage Considerations The word "com" cannot be used as a program name or variable name. The COM operation is meaningful only when performed on an integer value. Only the integer parts of real values are used. Any fractional parts are ignored. Parameter value Real-valued expression defining the value to be complemented. Details The COM operator performs the binary complement operation on a bit-by-bit basis, resulting in a real value. Specifically, the COM operation consists of the following steps: 1.

Convert the operand to a sign-extended 32-bit integer, truncating any fractional part. 2. Perform a binary complement operation. 3. Convert the result back to a real value. To review the order of evaluation for operators within expressions, see the section Order of Evaluation in the eV+ Language User's Guide . Examples For example: COM 40 yields -41 Note that a very different result is obtained with the logical complement operation (NOT): NOT 40 yields 0.0 (FALSE) In this case, 40 is interpreted as logically TRUE since it is nonzero. eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 129