Binary System of Signed Integers
We will not be using a minus sign (\(-\)) to represent negative numbers. We would like to represent our binary numbers with only two symbols, 0 and 1. There are a few ways to represent negative binary numbers. We will discuss each of these in the following subsections.
Note: Unlike other programming languages, where different types of integers exist (signed, unsigned, different number of bits), in Python there is only one integer type (
int). This is a signed integer type with arbitrary precision. This means, the integer has not a fixed number of bits to represent the number, but will dynamically use as many bits as needed to represent the number. Therefore, integer overflows cannot occur in Python. This doesn't hold forfloats, which have fixed size of 64 bit and can overflow.