Page 39 of 229 Start Back Next End ZBasic Language Reference 29 ZBasic Microcontrollers Arithmetic Operators Function Type Operator Permitted Operand Types Negation Unary - any numeric Addition Binary + any numeric Subtraction Binary - any numeric Multiplication Binary * any numeric¹ Division, Integer Binary \ any integral¹ Division, Real Binary / Single Modulus Binary Mod any numeric¹ Exponentiation Binary ^ any numeric² Notes: ¹ In BasicX mode, operating on UnsignedLong is not supported. ² The result will be the same type as the left operand. In BasicX mode, the left operand must be Single and the right operand must be either Single or Integer. For Single operands, dividing by zero produces a special value indicating either positive or negative infinity depending on the sign of the dividend. Dividing 0.0 by 0.0 produces a special value called NaN, representing a value that is “Not a Number”. Similarly, performing the Mod operation with Single values using a divisor of zero produces a NaN. For all other operand types the result of using a zero divisor for either division or Mod is undefined. The System Library function SngClass() returns a value indicating the general classification of a value of type Single. See the description of SngClass() in the System Library Reference Manual for more information. 2.4.4 Logical Operators The logical operators are listed in the table below along with the permitted operand types. The result is the same type as the operand(s). Logical Operators Function Type Operator Permitted Operand Types Logical AND (conjunction) Binary And Boolean Bitwise AND Binary And any integral¹ Logical OR (disjunction) Binary Or Boolean Bitwise OR Binary Or any integral¹ Logical XOR (exclusive disjunction) Binary Xor Boolean Bitwise XOR Binary Xor any integral¹ Logical Complement Unary Not Boolean Bitwise Complement Unary Not any integral¹ Notes: ¹ If Option Strict is enabled, signed types are not allowed. 2.4.5 Comparison Operators The comparison operators are listed in the table below along with the permitted operand types. The result type is Boolean. Comparison Operators Function Type Operator Permitted Operand Types Equality Binary = any Inequality Binary <> any Greater Than Binary > String or any numeric Greater Than or Equal To Binary >= String or any numeric Less Than Binary < String or any numeric Less Than or Equal To Binary <= String or any numeric