Mathematical Operators

Mathematical operators are provided for many data types.

Operator Description Example Result
!

Factorial

5 !
120
+

Addition

2 + 3
5

Subtraction

2 – 3
–1
*

Multiplication

2 * 3
6
/

Division (integer division produces NUMERIC results).

4 / 2
2.00...
//

With integer division, returns an INTEGER rather than a NUMERIC.

117.32 // 2.5
46
%

Modulo (remainder)

5 % 4
1
^

Exponentiation

2.0 ^ 3.0
8
|/

Square root

|/ 25.0
5
||/

Cube root

||/ 27.0
3
!!

Factorial (prefix operator)

!! 5
120
@

Absolute value

@ -5.0
5
&

Bitwise AND

91 & 15
11
|

Bitwise OR

32 | 3
35
#

Bitwise XOR

17 # 5
20
~

Bitwise NOT

~1
-2
<<

Bitwise shift left

1 << 4
16
>>

Bitwise shift right

8 >> 2
2

Notes