Skip to main content

Arithmetic Operators

Introduced or updated: v1.2.53
OperatorDescriptionExampleResult
+ (unary)Returns a+55
+Adds two numeric expressions4 + 15
- (unary)Negates the numeric expression-5-5
-Subtract two numeric expressions4 - 13
*Multiplies two numeric expressions4 * 14
/Divides one numeric expression (a) by another (b)4 / 22
//Computes the integer division of numeric expression4 // 31
%Computes the modulo of numeric expression4 % 20
^Computes the exponentiation of numeric expression4 ^ 216
|/Computes the square root of numeric expression|/ 25.05
||/Computes the cube root of numeric expression||/ 27.03
@Computes the abs of numeric expression@ -5.05
&Computes the bitwise and of numeric expression91 & 1511
|Computes the bitwise or of numeric expression32 | 335
#Computes the bitwise xor of numeric expression17 # 520
~Computes the bitwise not of numeric expression~ 1~2
**<<**Computes the bitwise shift left of numeric expression**1 << 4**16
>>Computes the bitwise shift right of numeric expression8 >> 22
**<->**Computes the Euclidean distance (L2 norm) between vectors**[1, 2] <-> [2, 3]**1.4142135
Did this page help you?
Yes
No