This section of notes will discuss about the internal coding of integer numbers, for floating (REAL) numbers, one way of representation will be discussed in the next lesson, and further discussed in A2 Level.

Representation of unsigned integers

This is very easy, to represent unsigned integer numbers, just convert the denary (decimal) to the corresponding binary.

For example,

5 (denary) → 101 (binary)

As a result, the binary representation of denary number 5 is 101.

Representation of negative numbers

To represent negative numbers, it is slightly complicated.

There are two ways to represent a negative binary number.

The first one is called sign and magnitude representation; while the second one is called two’s complement. Each method has its own advantages, but modern computers tend to use the later one. Let’s explore them together.

Sign & Magnitude Representation.

To store negative numbers, we add one extra sign bit on the left hand side of the binary (which is also called the most significant bit (MSB)) to represent positive or negative.