0% found this document useful (0 votes)
50 views2 pages

Review of Number System

The document discusses different number systems including binary, decimal, hexadecimal and their conversions. It provides examples of binary addition and subtraction. Binary numbers are added like decimal numbers, carrying a 1 to the next column when the sum is 2 or more. To perform subtraction in binary, the number is converted to its 2's complement by flipping all bits and adding 1.

Uploaded by

Mohamad Hasnan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views2 pages

Review of Number System

The document discusses different number systems including binary, decimal, hexadecimal and their conversions. It provides examples of binary addition and subtraction. Binary numbers are added like decimal numbers, carrying a 1 to the next column when the sum is 2 or more. To perform subtraction in binary, the number is converted to its 2's complement by flipping all bits and adding 1.

Uploaded by

Mohamad Hasnan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1

Review of number system


Binary number
Decimal number - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. 354 means that you have three 100s, ve 10s and four 1s. Decimal number is base 10 number. Binary is base 2 number. Contains only two digits, 0 and 1. Comparatively, 3 5 4 102 100 300 1 24 16 0 23 8 101 10 50 1 22 4 100 1 4 1 21 2 0 20 1 for binary (2210 ). How do you get 22? It is just by multifor decimal and

16 4 2 plying all the components corresponding to 1.

Hexadecimal number
Better representation of binary number is in form of hexadecimal. Imagine you have 1010100100100010111010112 . Can you remember all it? That number is common in computer language. For easier representation, we use hexadecimal number. Or in short, hex number. 1010100100100010111010112 can be represented by hex number A922EB which is easier to remember. How to change from long binary number to short hex number? First seperate binary number into groups of four. 1010 1001 0010 0010 1110 1011

Change each group to equivalent decimal 1010 10 1001 9 0010 2 0010 2 1110 14 1011 11

Replace value of 10 to 15 to equaivalent A to F 1010 10 A It is that simple. 1001 9 9 0010 2 2 0010 2 2 1110 14 E 1011 11 B

Binary addition
Two arithmetic operation done a lot in a computer is addition and subtraction. They do it in binary. In binary there are only two digits. So the addition works just like decimal addition. For example, you add 9 and 1 you will get 10. Why? because in decimal, 9 is the largest digit and after it there is no other digit.

2 Therefore when it is added with 1, it will return to 0 and there will be 1 carry forward making the answer 10. So does the binary. If you add 1 and 1 you will get 10 since 1 is the largest number. The reasoning is the same. Example 11111 10010110 +00111011 11010001 carry bits rst number = 150 (or 96H ) second number = 59 (or 3BH ) result = 209 (or D1H )

Binary subtraction
We use addition to do subtraction in microprocessor. For example, subtracting 50 from 18 is actually adding 50 with 18. To convert 18 to 18 we use technique called 2 s complement. We do the following to nd 2s complement. 00010010 11101101 + 1 11101110 positive 18 in 8-bit binary complement each bit add 1 the 2s complement of 18

2s complement is the way we interpret a binary number. The 18 representation of 11101110 must be interpret as a signed number. A signed number uses the MSB as the sign. 0 means positive and 1 means negative. So we have 00010010 11101110 +18, sign bit is 0 18, sign bit is 1

So now if we add 50 and 18 using binary, we have 111111 00110010 +11101110 00100000 carry bits 50 18 32

You might also like