Binary System of Signed Integers
Since digital electronics only have access to two levels standing for 0 and 1, we will not be able to use a minus sign (\(-\)) for representing negative numbers. There are a few common ways to represent negative binary numbers by only using ones and zeros, which we will discuss in the following subsections.
Note: Unlike other programming languages, where different types of integers exist (signed, unsigned, different number of bits), Python only has one integer type (
int). This is a signed integer type with arbitrary precision. This means, the integer does not have 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.