Home / cat / arithop 
Arithmetic Operators
Number + Number Adds two numbers.
- Number Computes the opposite sign of a number. Zero is the opposite of itself.
Number - Number Subtracts two numbers.
Number * Number Multiplies two numbers.
Number / Number Divides two numbers. A Division By Zero (#26) error will occur if the value of the number to the right of the slash is zero.
Number ^ Power Raises Number to the power Power.

For example, 4 ^ 3 = 64

Number \ Number

Number DIV Number

Computes the quotient of the two Integer numbers, truncating the result. A Division By Zero (#26) error will occur if the value of the number to the right of the backslash is zero.

For example, 13 \ 6 = 2

A \ B = Int(A / B)

Number MOD Number Computes the remainder of the quotient of the two numbers. A Division By Zero (#26) error will occur if the value of the number to the right of the operator MOD is zero.

Comparison

Number = Number Returns TRUE if two numbers are equal.
Number <> Number Returns TRUE if two numbers are different.
Number1 < Number2 Returns TRUE if Number1 is strictly lower than Number2.
Number1 > Number2 Returns TRUE if Number1 is strictly greater than Number2.
Number1 <= Number2 Returns TRUE if Number1 is lower or equal than Number2.
Number1 >= Number2 Returns TRUE if Number1 is greater or equal than Number2.

If the result of a Comparison is assigned to an integer variable, then the result is either -1 (True) or 0 (False)

Order of evaluation

Operator Example
- (negation) f = - g ^ 2 is the same as ( - g ) ^ 2
^ i = 4 ^ 2 * 3 ^ 3 is the same as (4 ^ 2) * ( 3 ^ 3 )
* / i = 4 * 2 + 3 * 3 is the same as (4 * 2) + ( 3 * 3 )
+ -

= <> >= <= > <= i = 4 + 2 = 5 + 1 is the same as ( 4 + 2 ) = ( 5 + 1 )
OR AND XOR i = a > 10 AND a < 20 is the same as ( a > 10 ) AND ( a < 20 )

If in doubt, rather use braces ( ) to group subexpressions.


See also
Logical Operators