• < LESS THAN (float < float = boolean) (1 < 2 = TRUE)
If left argument is less than right argument, return TRUE, else return FALSE
• >= GREATER THAN OR EQUAL TO (float >= float = boolean) (1 >= 1 =TRUE)
If left argument is greater than or equal to right argument, return TRUE, else return FALSE.
• <= LESS THAN OR EQUAL TO (float <= float = boolean) (1 <= 2 =TRUE)
If left argument is less than or equal to right argument, return TRUE, else return FALSE.
11.10 Bit-wise Operators (&, |, ^)
These operators allow bit-wise calculations. Bit-wise algebra is a specialist and complex subject and is
not discussed here in depth. Please refer to a suitable programming textbook for a detailed discussion of how to
use bit-wise algebra.
11.11 Shift Operators (>>, <<)
Shift operators >> and << are used to move bits right and left in an integer and are often used in the
manipulation of packed coils etc.
• 1<<2 resulting in 4
This will shift left the number 1 by two binary positions and is equivalent to multiplying by 4.
• 64>>1 resulting in 32
This will shift right the number 64 by one binary positions and is equivalent to dividing by 2.
Shift operators generally produce clearer code.
11.12 Pointer Arithmetic Operators
There are two operators for manipulating register pointers. Each register in the InSpec has three data
values associated with it. Firstly, it has type, i.e. integer or character etc. Secondly it has value (the actual data
that is stored and can be changed). Lastly it has two means of identification, a text string and a number. The UCL
language allows the passing of a register's value into an equation by entering the registers textual name (i.e.
i_ispare1 = i_ispare1 + 1;). The following two unary operators enable conversion between register identification
and value.
• @ ADDRESS (@ register name = integer) (@ i_ispare1 = 330)
The ADDRESS operator returns the integer ID number of the register passed to it.
• # POINTER (# register ID name or number = any) (# 330 = 0)
The POINTER operator returns the value held within the register passed to it, either by name or number.
11.13 Complex Math Operators (LOG, LN, POW, SIN, COS, TAN,
ASIN, ACOS, ATAN)
These complex math operators are easily utilised in equations as the following single line equations
show:
11.13.1 LOG EXAMPLE
F_USER_FLOAT2=LOG(F_USER_FLOAT1);
This produces the log to base 10 for the value of register F_USER_FLOAT1.
11.13.2 LN EXAMPLE
F_USER_FLOAT2=LN(F_USER_FLOAT1);