0% found this document useful (0 votes)
15 views12 pages

Number System

Uploaded by

Shabanam Tamboli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views12 pages

Number System

Uploaded by

Shabanam Tamboli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Number System

Dr. Shikalgar S. K.

SITCOE, Yadrav
Contents
 Binary Number System
 Decimal Number System
 Octal Number System
 Hexadecimal Number System
The basics:
 Bases we will use
◦ Binary: Base 2
◦ Octal: Base 8
◦ Decimal: Base 10
◦ Hexadecimal: Base 16
 Positional number system
◦ 1012= 1×22 + 0×21 + 1×20
◦ 638 = 6×81 + 3×80
◦ A116= 10×161 + 1×160
Binary → hex/decimal/octal
conversion
 Conversion from binary to octal/hex
◦ Binary: 10011110001
◦ Octal: 10 | 011 | 110 | 001=23618
◦ Hex: 100 | 1111 | 0001=4F116
 Conversion from binary to decimal
◦ 1012= 1×22 + 0×21 + 1×20 = 510
◦ 63.48 = 6×81 + 3×80 + 4×8–1 = 51.510
◦ A116= 10×161 + 1×160 = 16110
Decimal→ binary/octal/hex
conversion

 Why does this work?


◦ N=5610=1110002
◦ Q=N/2=56/2=111000/2=11100 remainder
0
 Each successive divide liberates an LSB
(least significant bit)
Number systems
 Binary number representation
 3 approaches
◦ Sign-and-magnitude
◦ Ones-complement
◦ Twos-complement
 For all 3, the most-significant bit (MSB) is the sign digit
◦ 0 ≡ positive
◦ 1 ≡ negative
 twos-complement is the important one
◦ Simplifies arithmetic
◦ Used almost universally
Sign-and-magnitude
 The most-significant bit (MSB) is the sign digit
◦ 0 ≡ positive
◦ 1 ≡ negative
 The remaining bits are the number’s magnitude
 Problem 1: Two representations for zero
◦ 0 = 0000 and also –0 = 1000
 Problem 2: Arithmetic is cumbersome
Ones-complement
 Negative number: Bitwise complement positive
number
◦ 0011 ≡ 310
◦ 1100 ≡ –310
 Solves the arithmetic problem

 Remaining problem: Two representations for zero


◦ 0 = 0000 and also –0 = 1111
Twos-complement
 Negative number: Bitwise complement
plus one
◦ 0011 ≡ 310 –1 0
◦ 1101 ≡ –310 –2 1111 0000 +1

–3 1110 0001 +2
 Number wheel 1101 0010
–4 +3
1100 0011
 Only one zero!
– 5 1011 0100 + 4

 MSB is the sign digit 1010 0101


–6 1001 0110 +5
 0 ≡ positive
 1 ≡ negative –7 1000 0111 +6
–8 +7
Twos-complement (con’t)
 Complementing a complement  the
original number
 Arithmetic is easy
◦ Subtraction = negation and addition
 Easy to implement in hardware
Gray and BCD codes
Decimal Gray Decimal BCD
Symbols Code Symbols Code
0 0000 0 0000
1 0001 1 0001
2 0011 2 0010
3 0010 3 0011
4 0110 4 0100
5 0111 5 0101
6 0101 6 0110
7 0100 7 0111
8 1100 8 1000
9 1101 9 1001

You might also like