Docsity

Signed and Unsigned Numbers, Study notes of Software Engineering

Partial preview of the text

Download Signed and Unsigned Numbers and more Study notes Software Engineering in PDF only on Docsity!

Signed and Unsigned Numbers

An 8 bit number system can be used to create 256 combinations (from 0 to 255), and the first 128 combinations (0 to 127) represent positive numbers and next 128 combinations (128 to 255) represent negative numbers. The positive numbers are counted in a clockwise direction from 0 and the negative numbers are counted in a counter-clockwise direction.

In Decimal in order to get - 2, we subtract 2 from the number of combinations (256), which gives, 256 - 2 = 254. In Binary all the Signed Numbers have a '1' in the Most Significant Bit (MSB) position which represents a negative number and a '0' in the Most Significant Bit (MSB) position which represents a positive number. Also, in Binary, the 2's Complement of a number is the negative equivalent of the positive number. Equation Binary Hex Signed 2 = 0000 0010 02 + 1's Complement = 1111 1101 FD Add '1' +0000 0001 + 2's Complement = 1111 1110 FE - So, as above, +2 = 0000 0010 and the 2's Complement is 1111 1110 which represents - 2. A 16 bit number system can be used to create 65536 combinations (from 0 to 65535), and the first 32768 combinations (0 to 32767) represent positive numbers and next 32768 combinations (32768 to 65536) represent negative numbers. In a 16 bit number system the Signed Numbers have a '1' in the Most Significant Bit (MSB) position 1xxx xxxx xxxx xxxx which represents a negative number. A '0' in the Most Significant Bit (MSB) position 0xxx xxxx xxxx xxxx which represents a positive number.