# 2's complement fractions

MicrocontrollerMicroprocessor8085

As an example, the value of 1 001, if the interpretation is that it is a 2's complement fraction will be as follows -It is 1.001 assuming the binary point after the MS bit. As the MS bit is 1, it is a negative number. Then the remaining bits do not specify the magnitude directly. The 2's complement of 1 001 is 0110+ 1 = 0 111. This is a positive fraction with the value 1 × 2−1 +1 × 2−2 +1 × 2−3 = 0.5 + 0.25 + 0.125 = 0.875 decimal. Thus, -0.875 is the value of 1001.

If the word size is n bits, the smallest magnitude non-zero fraction that can be represented is2(n-1).A table of word size and the smallest magnitude fraction that can be represented as shown in the following.

Word size
Smallest magnitude 2 's complement fraction
4
±0.125
8
±0.0078125
16
±0.0000305
32
±0.5 × 10−9

The minimum word size has to be 8bits to represent the number -0.0123 somewhat accurately. The accuracy is very much improved if the word size is further increased.

To have a generic discussion on the representation of fractions, we can mention that to represent fractions may be necessary quite often inside a computer. For example, it may be needed to represent inside a computer a value like +0.610 or -0.610. To represent signed fractions, it is necessary to assume the binary point just after the MSB in the bit sequence. Such numbers where the binary point is assumed to be at a fixed position in the bit sequence are called fixed-point numbers.

Unsignedfractions will have the assumed binary point at the extreme left. SM,1's complement, and 2's complement fractions will have this imaginary binary point just to the right of the MS bit.

If the imaginary point is at the extreme right, then the number is an integer. If the imaginary binary point is at the extreme left for an unsigned number, the number is an unsigned fraction. If the binary point is to the immediate right of the MS bit, the number is a signed fraction. If the binary point is in the middle of a bit sequence, the number has an integer and a fractional part.