Int
128-bit signed integers.
Constructor
Int accepts an integer, a boolean, or an integral float. It rejects
fractional floats and interpretive conversions such as parsing strings.
The lowercase int function performs coercion and parsing:
Methods
binary()
Formats the integer in base 2.
Returns: Str
octal()
Formats the integer in base 8.
Returns: Str
hex()
Formats the integer in lowercase base 16.
Returns: Str
Operators
Arithmetic
| Operator | Description | Result |
|---|---|---|
+ |
Addition | Int |
- |
Subtraction | Int |
* |
Multiplication | Int |
/ |
Division | Float |
// |
Euclidean (integer) division | Int |
% |
Euclidean remainder | Int |
-x |
Negation | Int |
/ always produces a Float. // and % satisfy the identity
x == (x // y) * y + (x % y).
Bitwise
| Operator | Description |
|---|---|
& |
AND |
\| |
OR |
^ |
XOR |
~x |
NOT |
<< |
Left shift |
>> |
Right shift |
Comparison
==, !=, <, >, <=, >=
Mixed int/float comparisons are supported.