Math and Logic Operators Table


Operator


Assignment Usage

Constant Expressions1


Is Unary


Description

Integer

Float

=

always

n/a1

n/a1

 

Constant Assignment '=' (CON blocks only)

:=

always

n/a1

n/a1

 

Variable Assignment ':=' (PUB/PRI blocks only)

+

+=

 

Add '+', '+='

+

never

Positive (unary form of Add) '+' (+X)

-

-=

 

Subtract '-', '-='

-

if solo

Negate (unary form of Subtract) '-' (-X)

 

always

 

 

Decrement, pre- or post- '--' ((--X) or (X--))

++

always

 

 

Decrement, pre- or post- '++' ((++X) or (X++))

*

*=

 

Multiply, Return Low '*', '*=',  multiply and return lower 32 bits (signed)

**

**=

 

 

Multiply, Return High '**', '**=', multiply and return upper 32 bits (signed)

/

/=

 

Divide '/', '/=' (signed)

//

//=

 

 

Modulus '//', '//=' (signed)

#>

#>=

 

Limit Minimum '#>', '#>=' (signed)

<#

<#=

 

Limit Maximum '<#', '<#=' (signed)

^^

if solo

Square Root '^^'

| |if solo Absolute Value '| |'

~

always

 

 

Sign-Extend 7 or Post-Clear '~', sign-extend from bit 7 (~X) or post-clear to 0 (X~); all bits low

~~

always

 

 

Sign-Extend 15 or Post-Set '~~', sign-extend from bit 15 (~~X) or post-set to -1 (X~~); all bits high

~>

~>=

 

 

Bitwise Shift Arithmetic Right '~>', '~>='

?

always

 

 

Random '?', random number forward (?X) or reverse (X?)

|<if solo Bitwise Decode '|<', decode value (0 - 31) into single-high-bit long
>|if solo Bitwise Encode '>|', encode long into value (0 - 32) as high-bit priority

<<

<<=

 

 

Bitwise Shift Left '<<', '<<='

>>

>>=

 

 

Bitwise Shift Right '>>', '>>='

<-

<-=

 

 

Bitwise Rotate Left '<-', '<-='

->

->=

 

 

Bitwise Rotate Right '->', '->='

><

><=

 

 

Bitwise Reverse '><', '><='

&

&=

 

 

Bitwise AND '&', '&='

||= Bitwise OR '|', '|='

^

^=

 

 

Bitwise XOR '^', '^='

!

if solo

 

Bitwise NOT '!'

AND

AND=

 

Boolean AND 'AND', 'AND=' (promotes non-0 to -1)

OR

OR=

 

Boolean OR 'OR', 'OR=' (promotes non-0 to -1)

NOT

if solo

Boolean NOT 'NOT' (promotes non-0 to -1)

==

===

 

Boolean Is Equal '==', '==='

<>

<>=

 

Boolean Is Not Equal '<>', '<>='

<

<=

 

Boolean Is Less Than '<', '<=' (signed)

>

>=

 

Boolean Is Greater Than '>', '>=' (signed)

=<

=<=

 

Boolean Is Equal or Less '=<', '=<=' (signed)

=>

=>=

 

Boolean Is Equal or Greater '=>', '=>=' (signed)

@

never

 

Address Symbol '@'

@@

never

 

 

Object Address Plus Symbol '@@'

1 Assignment forms of operators are not allowed in constant expressions.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.