Module 1 Number System and Arithmetic Operations
Module 1 Number System and Arithmetic Operations
I. N U M B E R S Y S T E M
A . B A C K G R O U N D A N D H IS T O R Y
A s you h a ve seen a lr e a d y , n u m b e r s a re e x t r e m e ly im p o r t a n t in
y o u r m ilit a r y a n d p e r s o n a l life . Y ou r e a liz e t h a t you n eed m ore th a n
y o u r fin g e r s a n d t o e s t o k e e p t r a c k o f t h e n u m b e r s in y o u r d a ily r o u t in e .
T h e fir s t a d d in g m a c h in e w a s in v e n t e d b y B la is e P a s c a l (F r e n c h )
B . M O D E R N U S E
P e o p le a n d c o m p u t e r s d o n o t n o r m a lly s p e a k t h e s a m e la n g u a g e.
M e t h o d s o f t r a n s la t in g in fo r m a t io n in t o fo r m s t h a t a r e u n d e r s t a n d a b le
a n d u s a b le to b oth a re n ecessa ry. H u m a n s g e n e r a lly spea k in w ords
a n d n u m bers expressed in th e d e c im a l n u m ber sy stem , w h ile
com p u ters o n ly u n d ersta n d coded e le c t r o n ic p u ls e s th a t represen t
d ig it a l in fo r m a t io n .
F lo r e n c e M . B a n a s ih a n Page 1
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
C . T Y P E S O F N U M B E R S Y S T E M S
U n t il n o w , y o u h a v e p r o b a b ly u s e d o n ly o n e n u m b e r s y s t e m , t h e
d e c im a l sy stem . Y ou m a y a ls o be fa m ilia r w it h th e R om a n n u m eral
sy stem , even t h o u g h y o u s e ld o m u s e it .
1 . T H E D E C IM A L N U M B E R S Y S T E M
E a ch o f t h e n u m b e r s y s t e m s y o u w ill s t u d y is b u ilt a r o u n d
th e fo llo w in g com p on en ts: th e U N IT , N U M B E R , a n d B A S E
(R A D IX ).
a . U n it a n d N u m b e r
3 th rou g h 9 a r e t h e s y m b o ls u s e d in t h e d e c im a l s y s t e m . T h e s e
s y m b o ls a re c a lle d A r a b ic n u m e r a ls or fig u r e s . O th er s y m b o ls
m a y be u sed fo r d iffe r e n t n u m ber sy stem s. F or e x a m p le , th e
s y m b o ls u s e d w it h t h e R o m a n n u m era l sy stem a r e le t t e r s - V is
t h e s y m b o l fo r 5 , X fo r 1 0 , M fo r 1 ,0 0 0 , a n d s o fo r t h . W e w ill u s e
A r a b ic n u m e r a ls a n d le t t e r s in t h e n u m b e r s y s t e m d is c u s s io n s in
t h is c h a p t e r .
b. B a se (R a d ix )
t h e d e c im a l s y s t e m is 1 0 . T h is m ea n s th ere a re 1 0 s y m b o ls - 0,
1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , a n d 9 - u s e d in t h e s y s t e m . A n u m b e r s y s t e m
u s in g t h r e e s y m b o ls - 0 , 1 , a n d 2 - w o u ld b e b a s e 3 ; fo u r s y m b o ls
w o u ld b e b a s e 4 ; a n d s o fo r t h . R e m e m b e r t o c o u n t t h e z e r o o r t h e
sym bol u sed fo r z e r o w h en d e t e r m in in g t h e n u m b e r o f s y m b o ls
u s e d in a n u m b er sy stem .
Th e ba se of a n u m ber sy stem is in d ic a t e d by a s u b s c r ip t
(d e c im a l n u m ber) fo llo w in g th e v a lu e of th e n u m ber. Th e
F lo r e n c e M . B a n a s ih a n Page 2
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
c . P o s it io n a l N o t a t io n a n d Z e ro
Y ou m u st observe t w o p r in c ip le s w h en c o u n t in g o r w r it in g
q u a n t it ie s or n u m e r ic a l v a lu e s . Th ey a re th e P O S IT IO N A L
N O T A T IO N a n d th e Z E R O p r in c ip le s .
P o s it io n a l n o t a t io n is a s y s t e m w h e r e t h e v a lu e o f a n u m b e r
is d e fin e d n o t o n ly by th e sym bol bu t by t h e s y m b o l 's p o s it io n .
L e t 's e x a m in e th e d e c im a l (b a s e 10) v a lu e of 4 2 7 .5 . Y ou kn ow
fr o m e x p e r ie n c e t h a t t h is v a lu e is fo u r h u n d r e d t w e n t y - s e v e n a n d
o n e - h a lf. N o w e x a m in e t h e p o s it io n of ea ch n u m ber:
If 4 2 7 .5 is th e q u a n t it y you w is h to express, th en ea ch
n u m ber m u st be in th e p o s it io n sh ow n . If you exch a n ge th e
p o s it io n s o f t h e 2 a n d t h e 7 , t h e n y o u c h a n g e t h e v a lu e .
E a ch p o s it io n in t h e p o s it io n a l n o t a t io n s y s t e m represen ts
a p o w e r o f t h e b a s e , o r r a d ix . A P O W E R is t h e n u m b e r o f t im e s a
b a s e is m u lt ip lie d b y it s e lf. T h e p o w e r is w r it t e n a b o v e a n d t o t h e
r ig h t of th e ba se a n d is c a lle d a n E X PO N E N T. E x a m in e th e
fo llo w in g b a s e 1 0 lin e g r a p h :
F lo r e n c e M . B a n a s ih a n Page 3
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
N ow l e t 's lo o k a t th e v a lu e o f th e ba se 10 n u m ber 4 2 7 .5
w it h t h e p o s it io n a l n o t a t io n lin e g r a p h :
Y o u c a n s e e t h a t t h e p o w e r o f t h e b a s e is m u lt ip lie d b y t h e
n u m b e r in t h a t p o s it io n t o d e t e r m in e t h e v a lu e fo r t h a t p o s it io n .
A ll n u m bers to th e le ft of th e d e c im a l p o in t a re w h o le
n u m bers, a n d a ll n u m b e r s t o t h e r ig h t o f t h e d e c im a l p o in t a r e
fr a c t io n a l n u m b e r s . A w h o le n u m b e r is a s y m b o l t h a t r e p r e s e n t s
on e, or m ore, c o m p le t e o b je c t s , su ch a s on e a p p le or $5. A
fr a c t io n a l n u m b e r is a sym bol th a t rep resen ts a p o r t io n of a n
o b je c t , s u c h a s h a lf o f a n a p p le (.5 a p p le s ) o r a q u a r t e r o f a d o lla r
($ 0 .2 5 ). A m ix e d n u m ber rep resen ts on e, or m ore, c o m p le t e
F lo r e n c e M . B a n a s ih a n Page 4
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
o b je c t s , a n d som e p o r t io n of a n o b je c t , su ch a s on e a n d a h a lf
a p p le s (1 .5 a p p le s ). W h en you u se a n y ba se oth er th a n th e
d e c im a l sy stem , th e d iv is io n b etw een w h o le n u m bers a n d
fr a c t io n a l n u m bers is r e fe r r e d to a s th e R A D IX P O IN T . Th e
d e c im a l p o in t is a c t u a lly t h e r a d ix p o in t o f t h e d e c im a l s y s t e m ,
b u t th e term r a d ix p o in t is n o r m a lly n ot u sed w it h th e b a se 10
n u m b er sy stem .
J u s t a s im p o r t a n t a s p o s it io n a l n o t a t io n is t h e u s e o f t h e
zero. Th e p la c e m e n t o f t h e z e r o in a n u m ber ca n h a ve q u it e a n
e ffe c t on t h e v a lu e b e in g r e p r e s e n t e d . S o m e t im e s a p o s it io n in a
n u m ber does n ot h a ve a v a lu e b etw een 1 a n d 9 . C o n s id e r h ow
t h is w o u ld a ffe c t you r n ext pa ych eck. If you w ere e x p e c t in g a
c h e c k f o r $ 6 0 5 . 4 7 , y o u w o u l d n 't w a n t i t t o b e $ 6 5 . 4 7 . L e a v i n g o u t
t h e z e r o in t h is c a s e m e a n s a d iffe r e n c e o f $ 5 4 0 .0 0 . I n t h e n u m b e r
6 0 5 .4 7 , t h e z e r o in d ic a t e s t h a t t h e r e a r e n o t e n s . I f y o u p la c e t h is
v a lu e o n a ba r gra ph , you w ill s e e th a t th ere a re n o m u lt ip le s o f
1
10 .
M o s t S ig n ific a n t D ig it a n d L e a s t S ig n ific a n t D ig it (M S D a n d
L S D ) O t h e r im p o r t a n t fa c t o r s o f n u m b e r s y s t e m s t h a t y o u s h o u ld
r e c o g n iz e a re th e M O S T S IG N IF IC A N T D IG IT (M S D ) a n d th e
L E A S T S IG N IF IC A N T D IG IT (L S D ).
Th e M S D in a n u m ber is th e d ig it th a t h a s th e g re a te s t
e ffe c t o n th a t n u m b er.
Th e LS D in a n u m b e r is t h e d ig it t h a t h a s t h e le a s t e ffe c t
on th a t n u m b er.
L o o k a t t h e fo llo w in g e x a m p le s :
F lo r e n c e M . B a n a s ih a n Page 5
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
In a w h o le n u m ber th e LS D w ill a lw a y s be th e d ig it
im m e d ia t e ly t o t h e le ft o f t h e r a d ix p o in t .
P R O B L E M T S E T N O . 1 (Q 1 - 8 )
1. W h a t term d e s c r ib e s a s in g le o b je c t ?
2. A s y m b o l t h a t r e p r e s e n t s o n e o r m o r e o b je c t s is c a lle d a
_________.
3. T h e s y m b o ls 0 , 1 , 2 , a n d 3 t h r o u g h 9 a re w h a t ty p e of
n u m e r a ls ?
4. W h a t d o e s t h e b a s e , o r r a d ix , o f a n u m b e r s y s t e m t e lls y o u
a b ou t th e sy stem ?
6. W h a t p o w e r o f 1 0 is e q u a l t o 1 ,0 0 0 ? 100? 10? 1?
7. T h e d e c im a l p o in t o f t h e b a s e 1 0 n u m b e r s y s t e m is a ls o
kn ow n a s th e _________.
8. W h a t is t h e M S D a n d LS D o f t h e fo llo w in g n u m b e r s ?
(a ) 4 2 0 . (b ) 1 0 4 5 .0 6 (c ) 0 .0 0 2 4 (d ) 2 4 7 .0 0 0 1
F lo r e n c e M . B a n a s ih a n Page 6
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
2 . T H E B IN A R Y N U M B E R S Y S T E M
Th e s im p le s t p o s s ib le n u m ber sy stem is th e B IN A R Y , o r
ba se 2, sy stem . Y ou w ill be a b le to u se th e in fo r m a t io n ju s t
covered a b o u t t h e d e c im a l s y s t e m t o e a s ily r e la t e t h e s a m e t e r m s
t o t h e b in a r y s y s t e m .
a . U n it a n d N u m b e r
T h e b a s e o r r a d ix - y o u s h o u ld r e m e m b e r fr o m o u r d e c im a l
s e c t io n - is t h e n u m b e r o f s y m b o ls u sed in th e n u m b er sy stem .
S in c e t h is is t h e b a s e 2 s y s t e m , o n ly t w o s y m b o ls , 0 a n d 1, a re
u sed. Th e ba se is in d ic a t e d by a s u b s c r ip t , a s sh ow n in th e
fo llo w in g e x a m p le :
W it h n o s u b s c r ip t y o u w o u ld a s s u m e b o t h v a lu e s w e r e t h e
sa m e. If you a dd s u b s c r ip t s to in d ic a t e t h e ir ba se sy stem , a s
sh ow n b e lo w , t h e n t h e ir v a lu e s a r e q u it e d iffe r e n t :
Th e ba se ten n u m ber 11 10 is e le v e n , bu t th e ba se tw o
n u m ber 11 2 is o n ly eq u a l to th ree in ba se ten . Th ere w ill b e
o c c a s io n s w h e n m ore th a n on e n u m b er sy stem w ill b e d is c u s s e d
a t t h e s a m e t im e , s o y o u M U S T u s e t h e p r o p e r s u b s c r ip t .
b. P o s it io n a l N o t a t io n
A s in th e d e c im a l n u m ber sy stem , th e p r in c ip le of
F lo r e n c e M . B a n a s ih a n Page 7
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
A ll n u m b e r s o r v a lu e s t o t h e le ft o f t h e r a d ix p o in t a r e w h o le
n u m bers, a n d a ll n u m bers to th e r ig h t of th e r a d ix p o in t a re
fr a c t io n a l n u m b e r s .
L e t 's l o o k a t t h e b i n a r y n u m b e r 1 0 1 . 1 on a ba r gra ph :
W o r k in g fr o m t h e r a d ix p o in t t o t h e r ig h t a n d le ft , y o u c a n
d e t e r m in e t h e d e c im a l e q u iv a le n t :
T a b le 1 -2 p r o v id e s a c o m p a r is o n of d e c im a l a n d b in a r y
n u m bers. N o t ic e th a t ea ch t im e th e tota l n u m ber of b in a r y
s y m b o l p o s it io n s in c r e a s e s , t h e b in a r y n u m b e r in d ic a t e s t h e n e x t
h ig h e r p o w e r o f 2 . B y t h is e x a m p le , y o u ca n a ls o see th a t m ore
sym bol p o s it io n s a re n eeded in th e b in a r y sy stem to represen t
t h e e q u iv a le n t v a lu e in t h e d e c im a l s y s t e m .
T a b le 1 -2 . - D e c im a l a n d B in a r y C o m p a r is o n
F lo r e n c e M . B a n a s ih a n Page 8
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
c . M S D a n d L S D
W h en y o u 'r e d e t e r m in in g th e M S D a n d LS D fo r b in a r y
n u m bers, u se th e sa m e g u id e lin e s you u sed w it h th e d e c im a l
sy stem . A s y ou r e a d fr o m le ft t o r ig h t , t h e fir s t n o n z e r o d ig it y o u
e n c o u n t e r is t h e M S D , a n d t h e la s t n o n z e r o d ig it is t h e L S D .
If t h e n u m b e r is a w h o le n u m b e r , t h e n t h e fir s t d ig it t o t h e
le ft o f t h e r a d ix p o in t is t h e L S D .
F lo r e n c e M . B a n a s ih a n Page 9
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
H e r e , a s in t h e d e c im a l s y s t e m , t h e M S D is t h e d ig it t h a t
w ill h a v e t h e m o s t e ffe c t o n t h e n u m b e r ; t h e L S D is t h e d ig it t h a t
w ill h a v e t h e le a s t e ffe c t o n th e n u m b er.
T h e t w o n u m e r a ls o f t h e b in a r y s y s t e m (1 a n d 0 ) c a n e a s ily
be rep resen ted by m a n y e le c t r ic a l or e le c t r o n ic d e v ic e s . F or
e x a m p le , 1 2 m a y b e in d ic a t e d w h e n a d e v ic e is a c t iv e (o n ), a n d 0 2
m a y b e in d ic a t e d w h e n a d e v ic e is n o n - a c t iv e (o ff).
3 . O C T A L N U M B E R S Y S T E M
T h e o c t a l, o r b a s e 8 , n u m b e r s y s t e m is a com m on sy stem
u s e d w it h c o m p u t e r s . B e c a u s e o f it s r e la t io n s h ip w it h t h e b in a r y
s y s t e m , it is u s e fu l in p r o g r a m m in g s o m e t y p e s o f c o m p u t e r s .
L o o k c lo s e ly a t t h e c o m p a r is o n o f b in a r y a n d o c t a l n u m b e r
sy stem s in t a b le 1 -3 . Y ou ca n see th a t on e octa l d ig it is th e
F lo r e n c e M . B a n a s ih a n Page 10
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
e q u iv a le n t v a lu e o f t h r e e b in a r y d ig it s . T h e fo llo w in g e x a m p le s o f
th e c o n v e r s io n of octa l 225 8 to b in a r y a n d ba ck a g a in fu r t h e r
illu s t r a t e t h is c o m p a r is o n :
T a b le 1 -3 . - B in a r y a n d O c ta l C o m p a ris o n
a . U n it a n d N u m b e r
Th e term s th a t you le a r n e d in th e d e c im a l a n d b in a r y
s e c t io n s a r e a ls o u s e d w it h t h e o c t a l s y s t e m .
T h e u n it r e m a in s a s in g le o b je c t , a n d t h e n u m b e r is s t ill a
s y m b o l u s e d t o r e p r e s e n t o n e o r m o r e u n it s .
b. B a se (R a d ix )
F lo r e n c e M . B a n a s ih a n Page 11
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
A s w it h t h e o t h e r s y s t e m s , t h e r a d ix , o r b a s e , is t h e n u m b e r
of s y m b o ls u sed in th e sy stem . Th e octa l sy stem u ses e ig h t
s y m b o ls - 0 th rou g h 7. Th e ba se, or r a d ix , is in d ic a t e d by th e
s u b s c r ip t 8 .
c . P o s it io n a l N o t a t io n
A ll n u m bers to th e le ft of th e r a d ix p o in t a re w h o le
n u m b e r s , a n d t h o s e t o t h e r ig h t a r e fr a c t io n a l n u m b e r s .
F lo r e n c e M . B a n a s ih a n Page 12
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
d . M S D a n d L S D
W h en d e t e r m in in g th e m ost a n d le a s t s ig n ific a n t d ig it s in
a n o c t a l n u m b e r , u s e t h e s a m e r u le s t h a t y o u u s e d w it h t h e o t h e r
n u m b e r s y s t e m s . T h e d ig it fa r t h e s t t o t h e le ft o f t h e r a d ix p o in t is
t h e M S D , a n d t h e o n e fa r t h e s t r ig h t o f t h e r a d ix p o in t is t h e L S D .
E x a m p le :
If t h e n u m b e r is a w h o le n u m b e r , t h e M S D is t h e n o n z e r o
d ig it fa r t h e s t t o t h e le ft o f t h e r a d ix p o in t a n d t h e L S D is t h e d ig it
im m e d ia t e ly to th e le ft of th e r a d ix p o in t . C o n v e r s e ly , if th e
n u m b e r is a fr a c t io n o n ly , t h e n o n z e r o d ig it c lo s e s t to t h e r a d ix
p o in t is t h e M S D a n d th e L S D is t h e n o n z e r o d ig it fa r t h e s t t o t h e
r ig h t o f t h e r a d ix p o in t .
4 . H E X A D E C IM A L (H E X ) N U M B E R S Y S T E M
Th e h ex n u m b er sy stem is a m o r e c o m p le x sy stem in u se
w it h com p u ters. Th e n a m e is d e r iv e d fr o m th e fa c t th e sy stem
u ses 16 s y m b o ls . It is b e n e fic ia l in com p u ter p r o g r a m m in g
b e c a u s e o f it s r e la t io n s h ip t o t h e b in a r y s y s t e m . S in c e 1 6 in th e
4
d e c im a l s y s t e m is t h e fo u r t h p o w e r o f 2 (o r 2 ); o n e h e x d ig it h a s
a v a lu e eq u a l to fo u r b in a r y d ig it s . T a b le 1 -5 sh ow s th e
r e la t io n s h ip b e t w e e n th e tw o sy stem s.
F lo r e n c e M . B a n a s ih a n Page 13
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
T a b le 1 -5 . - B in a r y a n d H e x a d e c im a l C o m p a ris o n
a . U n it a n d N u m b e r
A s in ea ch o f t h e p r e v io u s n u m b er sy stem s, a u n it s t a n d s
fo r a s in g le o b je c t .
F lo r e n c e M . B a n a s ih a n Page 14
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
b. B a se (R a d ix )
Th e b a s e , o r r a d ix , o f t h is s y s t e m is 1 6 , w h ic h represen ts
t h e n u m b e r o f s y m b o ls u s e d in t h e s y s t e m . A q u a n t it y e x p r e s s e d
in h e x w ill b e a n n o t a t e d b y t h e s u b s c r ip t 1 6 , a s s h o w n b e lo w :
A 3E F 16
c . P o s it io n a l N o t a t io n
L ik e t h e b in a r y , o c t a l, a n d d e c im a l s y s t e m s , t h e h e x s y s t e m
is a p o s it io n a l n o t a t io n sy stem . Pow ers of 16 a re u sed fo r th e
p o s it io n a l v a lu e s o f a n u m b e r . T h e fo llo w in g b a r g r a p h s h o w s t h e
p o s it io n s :
M u lt ip ly in g th e ba se t im e s it s e lf th e n u m ber of t im e s
in d ic a t e d b y t h e e x p o n e n t w ill s h o w t h e e q u iv a le n t d e c im a l v a lu e :
Y ou ca n see fr o m t h e p o s it io n a l v a lu e s t h a t u s u a lly fe w e r
s y m b o l p o s it io n s a r e r e q u ir e d to express a n u m b e r in h ex th a n
in d e c im a l. T h e fo llo w in g e x a m p le s h o w s t h is c o m p a r is o n :
625 16 is e q u a l t o 1 5 7 3 10
d . M S D a n d L S D
F lo r e n c e M . B a n a s ih a n Page 15
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
Th e fo llo w in g e x a m p le s sh ow th e M S D a n d LS D of w h o le ,
fr a c t io n a l, a n d m ix e d h e x n u m b e r s :
D . C O N V E R S IO N O F B A S E S
W e m e n t io n e d in th e in t r o d u c t io n to t h is ch a p ter th a t d ig it a l
com p u ters op era te on e le c t r ic a l p u ls e s . T h e s e p u ls e s o r t h e a b s e n c e o f,
a re e a s ily rep resen ted by b in a r y n u m bers. A p u ls e ca n represen t a
b in a r y 1 , a n d t h e la c k o f a p u ls e c a n r e p r e s e n t a b in a r y 0 o r v ic e versa .
Th e s e c t io n s of t h is ch a p ter th a t d is c u s s e d octa l a n d h ex
n u m b ers b oth m e n t io n e d t h a t t h e ir n u m b e r s y s t e m s w e r e b e n e fic ia l t o
progra m m ers. Y ou w ill see la t e r in t h is s e c t io n th a t octa l a n d h ex
n u m b e r s a r e e a s ily c o n v e r t e d t o b in a r y n u m b e r s a n d v ic e v e r s a .
If y o u a r e g o in g t o w o r k w it h c o m p u t e r s , t h e r e w ill b e m a n y t im e s
w h en it w ill b e n e c e s s a r y t o c o n v e r t d e c im a l n u m b e r s t o b in a r y , o c t a l,
a n d h e x n u m b e r s . Y o u w ill a ls o h a v e t o b e a b le t o c o n v e r t b in a r y , o c t a l,
a n d h e x n u m b e r s t o d e c im a l n u m b e r s . C o n v e r t in g e a c h n u m b e r s y s t e m
to ea ch of th e oth ers w ill be e x p la in e d . T h is w ill prepa re you fo r
c o n v e r t in g fr o m a n y b a se to a n y oth er b a se w h en n eeded.
1 . D E C IM A L C O N V E R S IO N
F lo r e n c e M . B a n a s ih a n Page 16
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
a . D e c im a l t o B in a r y
C o n v e r s io n of a d e c im a l n u m ber to a n y oth er ba se is
a c c o m p lis h e d b y d iv id in g t h e d e c im a l n u m b e r b y t h e r a d ix o f t h e
sy stem you a re c o n v e r t in g to. T h e fo llo w in g d e fin it io n s id e n t ify
t h e b a s ic t e r m s u s e d in d iv is io n :
D IV ID E N D - T h e n u m b e r t o b e d iv id e d
D IV IS O R - T h e n u m b e r b y w h ic h a d iv id e n d is d iv id e d
Q U O T IE N T - Th e n u m ber r e s u lt in g fr o m th e d iv is io n of on e
n u m b er b y a n o th er R E M A IN D E R – Th e fin a l u n d iv id e d
p a r t a ft e r d iv is io n t h a t is le s s or of a lo w e r degree th a n th e
d iv is o r .
T o c o n v e r t a b a s e 1 0 w h o le n u m b e r t o it s b in a r y e q u iv a le n t ,
fir s t s e t u p t h e p r o b le m fo r d iv is io n :
S te p 1 - D iv id e t h e b a s e 1 0 n u m b e r b y t h e r a d ix (2 ) o f t h e b in a r y
sy stem a n d extra ct th e r e m a in d e r (t h is becom es th e b in a r y
n u m b e r 's L S D ) .
S te p 2 - C o n t in u e t h e d iv is io n b y d iv id in g t h e q u o t ie n t o f s t e p 1
b y t h e r a d ix (2 / 2 ).
S te p 3 - C o n t in u e d iv id in g q u o t ie n t s by th e r a d ix u n t il th e
q u o t ie n t becom es s m a lle r th a t th e d iv is o r ; th en do on e m ore
d iv is io n . T h e r e m a in d e r is o u r M S D .
F lo r e n c e M . B a n a s ih a n Page 17
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
Th e r e m a in d e r in step 1 is ou r LS D . N ow r e w r it e th e
s o lu t io n , a n d you w ill s e e th a t 5 10 e q u a ls 1 0 1 2. N ow fo llo w th e
c o n v e r s io n of 23 10 t o b in a r y :
S te p 1 - S e t u p t h e p r o b le m fo r d iv is io n :
S te p 2 - D iv id e t h e n u m b e r a n d e x t r a c t t h e r e m a in d e r :
F lo r e n c e M . B a n a s ih a n Page 18
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
S t e p 3 - R e w r it e t h e s o lu t io n fr o m M S D to L S D :
10111 2
N o m a tter h ow la r g e t h e d e c im a l n u m b e r m a y be, w e u se
th e sa m e p roced u re. L e t 's t r y t h e p r o b l e m b e lo w . It h a s a la r g er
d iv id e n d :
F lo r e n c e M . B a n a s ih a n Page 19
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
W e ca n c o n v e r t fr a c t io n a l d e c im a l n u m b e r s b y m u lt ip ly in g
t h e fr a c t io n b y t h e r a d ix a n d e x t r a c t in g t h e p o r t io n o f t h e p r o d u c t
t o t h e le ft o f t h e r a d ix p o in t . C o n t in u e t o m u lt ip ly t h e fr a c t io n a l
p o r t io n of th e p r e v io u s produ ct u n t il th e d e s ir e d degree of
a c c u r a c y is a t t a in e d .
T h e f ir s t fig u r e t o t h e le ft o f t h e r a d ix p o in t is t h e M S D , a n d
t h e la s t fig u r e o f t h e c o m p u t a t i o n is t h e L S D . R e w r it e t h e s o lu t io n
fr o m M S D to L S D preceded b y t h e r a d ix p o in t a s s h o w n :
.0 1 2
N ow t r y c o n v e r t in g .6 2 5 10 t o b in a r y :
A s w e m e n t io n e d b e fo r e , you s h o u ld c o n t in u e th e
o p e r a t io n s u n t il y o u rea ch th e d e s ir e d a ccu ra cy. F or e x a m p le ,
c o n v e r t .4 2 5 10 t o fiv e p la c e s in t h e b in a r y s y s t e m :
F lo r e n c e M . B a n a s ih a n Page 20
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
A lt h o u g h th e m u lt ip lic a t io n w a s c a r r ie d ou t fo r seven
p la c e s , you w o u ld o n ly u se w h a t is r e q u ir e d . W r it e ou t th e
s o lu t io n a s sh ow n :
0 .0 1 1 0 1 2
P R O B L E M S E T N U M B E R 2 (Q 4 8 - 5 3 )
C o n v e r t t h e fo llo w in g d e c im a l n u m b e r s t o b in a r y :
1. 48 72 10
2. 97 10 .
3. 243 10 .
4. 0 .8 7 5 10 (fo u r p la c e s ).
5. 0 .3 3 10 (fo u r p la c e s ).
6. 1 7 .4 2 10 (fiv e p la c e s ).
F lo r e n c e M . B a n a s ih a n Page 21
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
b . D e c im a l t o O c t a l
T h e c o n v e r s io n o f a d e c im a l n u m b e r t o it s b a s e 8 e q u iv a le n t
is don e by th e rep ea ted d iv is io n m eth od . Y ou s im p ly d iv id e th e
ba se 10 n u m ber by 8 a n d extra ct th e r e m a in d e r s . Th e fir s t
r e m a in d e r w ill b e th e LS D , a n d th e la s t r e m a in d e r w ill be th e
M S D .
L o o k a t t h e fo llo w in g e x a m p le . T o c o n v e r t 1 5 10 t o o c t a l, s e t
u p t h e p r o b le m fo r d iv is io n :
S in c e 8 g o e s in t o 1 5 o n e t im e w it h a 7 r e m a in d e r , 7 t h e n is
th e LS D . N ext d iv id e 8 in t o th e q u o t ie n t (1 ). Th e r e s u lt is a 0
q u o t ie n t w it h a 1 r e m a in d e r . T h e 1 is t h e M S D :
N ow w r it e o u t t h e n u m b e r fr o m M S D to L S D a s sh ow n :
17 8
Th e sa m e process is u sed r e g a r d le s s of th e s iz e of th e
d e c im a l n u m b e r . N a t u r a lly , m o r e d iv is io n s a re n eeded fo r la r g er
n u m b e r s , a s in t h e fo llo w in g e x a m p le :
C on vert 264 10 t o o c t a l:
F lo r e n c e M . B a n a s ih a n Page 22
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
B y r e w r it in g t h e s o lu t io n , y o u fin d t h a t t h e o c t a l e q u iv a le n t
of 264 10 is a s fo llo w s :
410 8
T o c o n v e r t a d e c im a l fr a c t io n t o o c t a l, m u lt ip ly t h e fr a c t io n
b y 8 . E x t r a c t e v e r y t h in g t h a t a p p e a r s t o t h e le ft o f t h e r a d ix p o in t .
Th e fir s t n u m b er extra cted w ill b e th e M S D a n d w ill fo llo w th e
r a d ix p o in t . T h e la s t n u m b e r e x t r a c t e d w ill b e t h e L S D .
C o n v e r t 0 .0 5 10 t o o c t a l:
W r it e t h e s o lu t io n fr o m M S D to L S D :
.0 3 1 4 6 8
Y ou ca n ca rry th e c o n v e r s io n ou t to a s m a n y p la c e s a s
n e e d e d , b u t u s u a lly fo u r o r fiv e p la c e s a r e e n o u g h .
T o c o n v e r t a m ix e d d e c im a l n u m b e r t o it s o c t a l e q u iv a le n t ,
s p lit t h e n u m b e r in t o w h o le a n d fr a c t io n a l p o r t io n s a n d s o lv e a s
sh ow n b e lo w :
C o n v e r t 1 0 5 .5 8 9 10 t o o c t a l:
F lo r e n c e M . B a n a s ih a n Page 23
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
C o m b in e t h e p o r t io n s in t o a m ix e d n u m b e r :
1 5 1 .4 5 5 4 8
P R O B L E M S E T N U M B E R 3 (Q 5 4 - 5 9 )
C o n v e r t t h e fo llo w in g d e c im a l n u m b e r s t o o c t a l:
1. 7 10
2. 43 10
3. 499 10
4. 0 .9 5 1 10 (fo u r p la c e s )
5. 0 .0 0 4 10 (fiv e p la c e s )
6. 2 5 2 .1 7 10 (t h r e e p la c e s ).
c . D e c im a l t o H e x
F lo r e n c e M . B a n a s ih a n Page 24
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
C on vert 63 10 to h ex:
T h e r e fo r e , t h e h e x e q u iv a le n t o f 6 3 10 is 3 F 16 .
Y o u h a v e t o r e m e m b e r t h a t t h e r e m a in d e r is in b a s e 1 0 a n d
m u st be con verted to h ex if it exceeds 9. L e t 's w ork th rou gh
a n o t h e r e x a m p le :
W r it e t h e s o lu t io n fr o m M S D to L S D :
A E 16
T h e r e w ill p r o b a b ly b e v e r y fe w t im e s w h e n y o u w ill h a v e t o
c o n v e r t a d e c im a l fr a c t io n t o a h e x fr a c t io n . I f t h e o c c a s io n s h o u ld
a r is e , t h e c o n v e r s io n is don e in th e sa m e m a n n er a s b in a r y or
o c t a l. U s e t h e fo llo w in g e x a m p le a s a p a t t e r n :
F lo r e n c e M . B a n a s ih a n Page 25
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
C o n v e r t 0 .6 9 5 10 to h ex:
T h e s o lu t io n : .B 1 E B 16
s e p a r a t e ly ; t h e n r e c o m b in e fo r t h e s o lu t io n .
P R O B L E M S E T N U M B E R 4 (Q 6 0 - 6 4 )
C o n v e r t t h e fo llo w in g d e c im a l n u m b e r s t o h e x :
1. 42 10
2. 83 10
3. 176 10
4. 491 10
5. 0 .7 2 1 10 (fo u r p la c e s ).
2 . B IN A R Y C O N V E R S IO N
E a r lie r in t h is c h a p t e r , w e m e n t io n e d t h a t t h e o c t a l a n d h e x
n u m b e r s y s t e m s a r e u s e fu l t o c o m p u t e r p r o g r a m m e r s . I t is m u c h
e a s ie r t o p r o v id e d a ta to a c o m p u t e r in on e or th e oth er of th ese
s y s t e m s . L ik e w is e , it is im p o r t a n t t o b e a b le t o c o n v e r t d a t a fr o m
F lo r e n c e M . B a n a s ih a n Page 26
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
a . B in a r y t o O c ta l
L o o k a t t h e fo llo w in g n u m b e r s :
Y o u c a n e a s ily s e e t h a t t h e o c t a l n u m b e r is m u c h e a s ie r t o
s a y . A lt h o u g h t h e t w o n u m b e r s lo o k c o m p le t e ly d iffe r e n t , t h e y a r e
e q u a l.
3
S in c e 8 is eq u a l to 2 , th en on e o c t a l d ig it ca n represen t
t h r e e b in a r y d ig it s , a s s h o w n b e lo w :
W it h th e u se o f t h is p r in c ip le , t h e c o n v e r s io n of a b in a r y
n u m b e r is q u it e s im p le . A s a n e x a m p le , fo llo w t h e c o n v e r s io n of
t h e b in a r y n u m b e r a t t h e b e g in n in g o f t h is s e c t io n .
N e x t , w r it e d o w n t h e o c t a l e q u iv a le n t o f e a c h grou p:
F lo r e n c e M . B a n a s ih a n Page 27
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
T o c o n v e r t a b in a r y fr a c t io n t o it s o c t a l e q u iv a le n t , s t a r t in g
a t th e r a d ix p o in t a n d m o v in g r ig h t , expa n d ea ch d ig it in t o a
g rou p of th ree:
A d d 0 s t o t h e r ig h t o f t h e L S D if n e c e s s a r y t o fo r m a grou p
of th ree. N ow w r it e th e octa l d ig it fo r ea ch grou p of th ree, a s
sh ow n b e lo w :
P R O B L E M S E T N U M B E R 5 (Q 6 5 - 7 0 )
C o n v e r t t h e fo llo w in g b in a r y n u m b e r s t o o c t a l:
1. 10 2
2. 1010 2
3. 101111 2
4. 0 .0 0 1 1 2
5. 0 .1 1 0 0 1 1 2
6. 1 1 0 1 1 1 .0 1 0 1 0 1 2 .
F lo r e n c e M . B a n a s ih a n Page 28
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
b . B in a r y t o H e x
T h e t a b le b e lo w s h o w s t h e r e la t io n s h ip b e t w e e n b in a r y a n d
h ex n u m bers. Y ou ca n see th a t fo u r b in a r y d ig it s m a y be
4
rep resen ted by on e h ex d ig it . T h is is b e c a u s e 1 6 is e q u a l t o 2 .
A dd 0s to th e le ft o f th e M S D of t h e w h o le p o r t io n of th e
n u m b e r a n d t o t h e r ig h t o f t h e L S D o f t h e fr a c t io n a l p a r t t o fo r m
a g r o u p o f fo u r .
C o n v e r t .1 1 1 2 to h ex:
F lo r e n c e M . B a n a s ih a n Page 29
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
P R O B L E M S E T N U M B E R 6 (Q 7 1 - 7 6 )
C o n v e r t t h e fo llo w in g b in a r y n u m b e r s t o h e x :
1. 10 2
2. 1011 2
3. 101111 2
4. 0 .0 0 1 1 2
5. 0 .1 1 0 0 1 1 2
6. 1 1 0 1 1 1 .0 1 0 1 0 1 2 .
3 . O C T A L C O N V E R S IO N
a . O c ta l to B in a r y
N e x t , b e lo w ea ch o c t a l d ig it w r it e t h e c o r r e s p o n d in g th ree -
d ig it b in a r y - c o d e d o c t a l e q u iv a le n t :
S o lu t io n : 5 6 7 8 e q u a ls 1 0 1 1 1 0 111 2
F lo r e n c e M . B a n a s ih a n Page 30
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
R e m o v e t h e c o n v e r s io n fr o m t h e fo r m a t :
101110111 2
A s y o u g a in e x p e r ie n c e , it m a y n o t b e n e c e s s a r y to u se th e
b lo c k fo r m a t .
A n o c t a l fr a c t io n (.1 2 3 8 ) is c o n v e r t e d in th e sa m e m a n n er,
a s sh ow n b e lo w :
S o lu t io n : .1 2 3 8 e q u a ls .0 0 1 0 1 0 0 1 1 2
A p p ly t h e s e p r in c ip le s t o c o n v e r t m ix e d n u m b e r s a s w e ll.
C o n v e r t 3 2 .2 5 8 t o b in a r y :
S o lu t io n : 3 2 .2 5 8 e q u a ls 0 1 1 0 1 0 .0 1 0 1 0 1 2
P R O B L E M S E T N U M B E R 7 (Q 7 7 - 8 2 )
C o n v e r t t h e fo llo w in g n u m b e r s t o b in a r y :
1. 73 8
2. 512 8
3. 403 8
4. 0 .4 5 6 8
5. 0 .7 3 8
6. 3 6 .5 8 .
F lo r e n c e M . B a n a s ih a n Page 31
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
b. O c ta l to H e x
Y o u w ill p r o b a b ly n o t r u n in t o m a n y o c c a s io n s t h a t c a ll fo r
t h e c o n v e r s io n of octa l n u m b ers to h e x . S h o u ld th e n eed a r is e ,
c o n v e r s io n is a t w o - s t e p p r o c e d u r e . C o n v e r t t h e o c t a l n u m b e r t o
b in a r y ; th en con vert th e b in a r y n u m ber to h ex. Th e step s to
c o n v e r t 5 3 .7 8 to h ex a re sh ow n b e lo w :
R e g r o u p t h e b in a r y d ig it s in t o g r o u p s o f fo u r a n d a d d z e r o s
w h e r e n e e d e d t o c o m p le t e g r o u p s ; t h e n c o n v e r t t h e b in a r y t o h e x .
S o lu t io n : 5 3 .7 8 e q u a ls 2 B .E 16
P R O B L E M S E T N U M B E R 8 (Q 8 3 - 8 6 )
C o n v e r t t h e fo llo w in g n u m b e r s t o h e x :
1. 74 8
2. 512 8
3. 0 .0 3 8
4. 1 4 .4 2 8 .
4 . H E X C O N V E R S IO N
Th e procedu res fo r c o n v e r t in g h ex n u m b e r s t o b in a r y a n d
o c t a l a r e t h e r e v e r s e o f t h e b in a r y a n d o c t a l c o n v e r s io n s to h ex.
a . H e x t o B in a r y
To con vert a h ex n u m b e r t o b in a r y , s e t u p t h e n u m b e r in
t h e b lo c k fo r m a t y o u u s e d in e a r lie r c o n v e r s io n s . B e lo w ea ch h ex
d ig it , w r it e t h e fo u r - d ig it b in a r y e q u iv a le n t . O b s e r v e t h e fo llo w in g
e x a m p le :
F lo r e n c e M . B a n a s ih a n Page 32
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
C on vert A B C 16 t o b in a r y :
S o lu t io n : A B C 16 = 101010111100 2
b. H e x to O c ta l
J u s t lik e t h e c o n v e r s io n of octa l to h e x , c o n v e r s io n of h ex
t o o c t a l is a t w o - s t e p p r o c e d u r e . F ir s t , c o n v e r t t h e h e x n u m b e r t o
b i n a r y ; a n d s e c o n d , c o n v e r t t h e b i n a r y n u m b e r t o o c t a l . L e t 's u s e
t h e s a m e e x a m p le w e u s e d a b o v e in t h e h e x t o b in a r y c o n v e r s io n
a n d c o n v e r t it t o o c t a l:
P R O B L E M S E T 9 (Q 8 7 - 9 0 )
ba se 8 n u m b ers:
1. 23 16
2. 1B 16
3. 0 .E 4 16
4. A 16
5 . C O N V E R S IO N T O D E C IM A L
C o m p u t e r d a t a w ill h a v e lit t le m e a n in g t o y o u if y o u a r e n o t
fa m ilia r w it h t h e v a r io u s n u m b e r s y s t e m s . It is o ft e n n ecessa ry
to con vert th ose b in a r y , o c t a l, or h ex n u m bers to d e c im a l
n u m bers. Th e n eed fo r u n d e r s t a n d in g is b etter illu s t r a t e d by
s h o w in g y o u a p a y c h e c k p r in t e d in b in a r y . A c h e c k in t h e a m o u n t
F lo r e n c e M . B a n a s ih a n Page 33
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
o f $ 1 0 ,0 1 0 ,1 0 1 .0 0 2 lo o k s im p r e s s iv e b u t in r e a lit y o n ly a m o u n ts
t o $ 1 4 9 .0 0 10 .
a . B in a r y t o D e c im a l
c o m p u t e r s , h o w e v e r , d o n 't a u t o m a t ic a lly c o n v e r t fr o m b in a r y t o
d e c im a l. Th ere m a y be t im e s w h en you m u st con vert
m a t h e m a t ic a lly .
T o con vert a b a se 2 n u m b er to b a se 1 0 , y ou m u st k n ow th e
d e c im a l e q u iv a le n t of ea ch pow er of 2. Th e d e c im a l v a lu e of a
pow er of 2 is o b t a in e d by m u lt ip ly in g 2 by it s e lf t h e n u m ber of
t im e s in d ic a t e d b y t h e e x p o n e n t fo r w h o le n u m b e r s ; fo r e x a m p le ,
4
2 = 2 X 2 X 2 X 2 or 16 10 .
F or fr a c t io n a l n u m bers, th e d e c im a l v a lu e is eq u a l to 1
d iv id e d b y 2 m u lt ip lie d b y it s e lf t h e n u m b e r o f t im e s in d ic a t e d b y
t h e e x p o n e n t . L o o k a t t h is e x a m p le :
Th e t a b le b e lo w sh ow s a p o r t io n of th e p o s it io n s a n d
d e c im a l v a lu e s o f t h e b in a r y s y s t e m :
A n oth er m eth od of d e t e r m in in g th e d e c im a l v a lu e of a
p o s it io n is t o m u lt ip ly t h e p r e c e d in g v a lu e b y 2 fo r w h o le n u m b e r s
a n d t o d iv id e t h e p r e c e d in g v a lu e b y 2 fo r fr a c t io n a l n u m b e r s , a s
sh ow n b e lo w :
F lo r e n c e M . B a n a s ih a n Page 34
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
Y ou m a y w a n t to w r it e th e d e c im a l e q u iv a le n t fo r ea ch
p o s it io n a s w e d id in t h e fo llo w in g e x a m p le . A d d o n ly t h e v a lu e s
in d ic a t e d b y a 1 .
P R O B L E M S E T 1 0 (Q 9 1 - 9 6 )
Y ou s h o u ld m a ke su re th a t th e d e c im a l v a lu e s fo r ea ch
p o s it io n a re p r o p e r ly a lig n e d b e fo r e a d d in g . F or p r a c t ic e l e t 's
c o n v e r t t h e s e b in a r y n u m b e r s t o d e c im a l:
1. 10010 2
2. 1111100 2
3. 1010101 2
4. 0 .0 1 0 1 2
5. 0 .1 0 1 0 2
6. 1 1 0 1 1 0 1 .1 1 1 1 2 .
F lo r e n c e M . B a n a s ih a n Page 35
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
b . O c t a l t o D e c im a l
C o n v e r s io n o f o c t a l n u m b e r s t o d e c im a l is b e s t d o n e b y t h e
p o s it io n a l n o t a t io n m eth od . T h is process is t h e on e w e u sed to
c o n v e r t b in a r y n u m b e r s t o d e c im a l.
F ir s t , d e t e r m in e t h e d e c im a l e q u iv a le n t fo r e a c h p o s it io n b y
m u lt ip ly in g 8 by it s e lf th e n u m ber of t im e s in d ic a t e d by th e
exp on en t. S et u p a ba r gra ph of th e p o s it io n s a n d v a lu e s a s
sh ow n b e lo w :
E x a m p le :
N e x t , m u lt ip ly t h e d e c im a l e q u iv a le n t b y t h e c o r r e s p o n d in g
d ig it o f t h e o c t a l n u m b e r ; t h e n , a d d t h is c o lu m n o f fig u r e s fo r t h e
fin a l s o lu t io n :
S o lu t io n : 7 4 3 8 is e q u a l t o 4 8 3 10
N ow fo llo w t h e c o n v e r s io n of 26525 8 t o d e c im a l:
F lo r e n c e M . B a n a s ih a n Page 36
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
S o lu t io n : 1 1 ,6 0 5 10 is t h e d e c im a l e q u iv a le n t o f 2 6 ,5 2 5 8
To con vert a fr a c t io n or a m ix e d n u m b e r , s im p ly u se th e
sa m e procedu re.
E x a m p le : C h a n g e .5 8 t o d e c im a l:
E x a m p le : C o n v e r t 2 4 .3 6 8 t o d e c im a l:
S o lu t io n : 2 4 .3 6 8 e q u a ls 2 0 .4 6 8 7 5 10
I f y o u r p r e fe r o r fin d it e a s ie r , y o u m a y w a n t t o c o n v e r t t h e
o c t a l n u m b e r t o b in a r y a n d t h e n t o d e c im a l.
F lo r e n c e M . B a n a s ih a n Page 37
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
P R O B L E M S E T 1 1 (9 7 - 1 0 2 )
C o n v e r t t h e fo llo w in g n u m b e r s t o d e c im a l:
1. 17 8
2. 64 8
3. 375 8
4. 0 .4 8
5. 0 .6 1 8
6. 1 0 .2 2 8 .
c . H e x t o D e c im a l
N o t e in th e b a r g ra p h b e lo w th a t ea ch pow er of 16 r e s u lt s
in a trem en d ou s in c r e a s e in th e d e c im a l e q u iv a le n t . O n ly on e
-1
n e g a t iv e p o w e r (1 6 ) is s h o w n fo r d e m o n s t r a t io n pu rposes:
Ju st a s you d id w it h o c t a l c o n v e r s io n , w r it e o u t th e h ex
n u m b e r , p la c in g ea ch d ig it u n d e r t h e a p p r o p r ia t e d e c im a l v a lu e
fo r t h a t p o s it io n . M u lt ip ly t h e d e c im a l v a lu e b y t h e b a s e 1 6 d ig it
a n d a dd th e v a lu e s . (C o n v e r t A th rou g h F to t h e ir d e c im a l
e q u i v a l e n t b e f o r e m u l t i p l y i n g ) . L e t 's t a k e a l o o k a t a n e x a m p le .
F lo r e n c e M . B a n a s ih a n Page 38
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
C on vert 2C 16 t o d e c im a l:
T h e d e c im a l e q u iv a le n t o f 2 C 16 is 4 4 10 .
If y o u c h o o s e t o c o n v e r t t h e h e x n u m b e r t o b in a r y a n d t h e n
t o d e c im a l, t h e s o lu t io n w ill lo o k lik e t h is :
P R O B L E M S E T 1 2 (Q 1 0 3 - 1 0 6 )
1. 24 16
2. A 5 16
3. D B 16
4. 3 E 6 .5 16
F lo r e n c e M . B a n a s ih a n Page 39
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
E . O T H E R B IN A R Y C O D E S
A s d is c u s s e d p r e v io u s ly , it w a s s h o w n t h a t d ig it a l d a t a is r e p r e s e n t e d ,
s t o r e d a n d t r a n s m it t e d a s g r o u p s o f b in a r y d ig it s a ls o k n o w n a s b in a r y
c o d e , t h e r e a r e s o m e o t h e r p o p u la r c o d e d n u m b e r s t h a t w e r e w id e ly
u sed.
1 . B IN A R Y -C O D E D D E C IM A L
In t o d a y 's t e c h n o lo g y , you h ea r a grea t dea l a bou t
m ic r o p r o c e s s o r s . A m ic r o p r o c e s s o r is a n in t e g r a t e d c ir c u it
d e s ig n e d fo r t w o p u r p o s e s : d a t a p r o c e s s in g a n d c o n t r o l.
B in a r y - c o d e d d e c im a l, o r B C D , is a m e t h o d o f u s in g b in a r y
d ig it s t o r e p r e s e n t t h e d e c im a l d ig it s 0 t h r o u g h 9 . A d e c im a l d ig it
is r e p r e s e n t e d b y fo u r b in a r y d ig it s , a s s h o w n b e lo w :
Y o u s h o u ld n o t e in t h e t a b le a b o v e t h a t t h e B C D c o d in g is
t h e b in a r y e q u iv a le n t o f t h e d e c im a l d ig it .
S in c e m a n y d e v ic e s u s e B C D , k n o w in g h o w t o h a n d le t h is
sy stem is im p o r t a n t . Y o u m u s t r e a liz e t h a t B C D a n d b in a r y a r e
n o t t h e s a m e . F o r e x a m p le , 4 9 10 in b in a r y is 1 1 0 0 0 1 2 , bu t 49 10 in
B C D is 0 1 0 0 1 0 0 1 B C D . E a c h d e c im a l d ig it is c o n v e r t e d t o it s b in a r y
e q u iv a le n t .
F lo r e n c e M . B a n a s ih a n Page 40
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
a . B C D C o n v e r s io n
Y ou ca n see by th e a b ove t a b le , c o n v e r s io n o f d e c im a l t o
B C D or B C D to d e c im a l is s im ila r to th e c o n v e r s io n of
h e x a d e c im a l t o b in a r y a n d v ic e v e r s a .
c o n v e r s io n s . F ir s t , w r it e o u t t h e d e c im a l n u m b e r t o b e c o n v e r t e d ;
t h e n , b e lo w ea ch d ig it w r it e t h e B C D e q u iv a le n t o f t h a t d ig it :
Th e B C D e q u iv a le n t of 264 10 is 001001100100 B C D . To
con vert fr o m B C D to d e c im a l, s im p ly reverse th e process a s
sh ow n :
b. B C D A d d it io n
A d d 9 a n d 6 in B C D :
Th e su m 1111 2 is t h e b in a r y e q u iv a le n t o f 1 5 10 ; h ow ever,
1111 is n ot a v a lid B C D n u m ber. Y ou ca n n ot exceed 1001 in
B C D , so a c o r r e c t io n fa c t o r m u s t b e m a de. To do t h is , y o u a dd
6 10 (0 1 1 0 B C D ) to th e su m of th e tw o n u m bers. Th e "a d d 6"
c o r r e c t io n fa c t o r is a d d e d to a n y B C D grou p la r g e r t h a n 1001 2 .
F lo r e n c e M . B a n a s ih a n Page 41
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
Th e su m p lu s th e a dd 6 c o r r e c t io n fa c t o r ca n th en be
con verted ba ck to d e c im a l t o c h e c k th e a n sw er . P u t a n y c a r r ie s
t h a t w e r e d e v e lo p e d in t h e a d d 6 p r o c e s s in t o a n e w 4 - b it w o r d :
N ow o b s e r v e t h e a d d it io n of 60 10 a n d 55 10 in B C D :
In t h is c a s e , t h e h ig h e r o r d e r g r o u p is in v a lid , b u t t h e lo w e r
o r d e r g r o u p is v a lid . T h e r e fo r e , t h e c o r r e c t io n fa c t o r is a d d e d o n ly
t o t h e h ig h e r o r d e r g r o u p a s s h o w n :
C o n v e r t t h is t o t a l t o d e c im a l t o c h e c k you r a n sw er:
R em em ber th a t th e c o r r e c t io n fa c t o r is a dded o n ly to
g rou p s th a t exceed 9 10 (1 0 0 1 B C D ).
F lo r e n c e M . B a n a s ih a n Page 42
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
P R O B L E M S E T 1 3 (Q 1 0 7 - 1 1 0 )
C o n v e r t t h e fo llo w in g n u m b e r s t o B C D a n d a dd:
1.
2.
3.
4.
2 . E X C E S S -O F -T H R E E C O D E
1 5
+ 3 + 3
4 8
T h is h a s t o b e c o n v e r t e d in B C D fo r m a s:
4 8
0100 1000
F lo r e n c e M . B a n a s ih a n Page 43
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
S u m m a r y o f t h e c o n v e r s io n o f d e c im a ls 0 t o 9 t o E x c e s s - 3 C odes
a r e a s fo llo w s :
T a b le 1 - 6 . E x a m p le s o f H o w E x c e s s - o f- t h r e e C o d e is p e r fo r m e d
E x a m p le :
1 . F in d t h e e x c e s s - 3 c o d e o f t h e d e c im a l n u m b e r o f
S o lu tio n :
T h e ex cess-3 c o d e fo r (2 3 7 )1 0 is o b t a in e d b y a d d in g 3 t o a ll
t h e d ig it s in d iv id u a lly , t h a t is 2 , 3 a n d 7 w ill b e c o m e 5 , 6 a n d 1 0
r e s p e c t iv e ly . T h e s e 5 , 6 a n d 1 0 d e c im a ls h a v e t o b e c o n v e r t e d in t o
b in a r y fo r m a n d t h e r e s u lt is 0 1 0 1 0 1 1 0 1 0 1 0 .
T h e ex cess-3 c o d e fo r (.7 5 )1 0 is o b t a in e d b y r e p la c in g 7 a n d
5 w it h 10 a n d 8 r e s p e c t iv e ly by a d d in g 3 to ea ch d ig it . T h a t is ,
th e ex cess-3 c o d e fo r (.7 5 ) ₁₀ is .1 0 1 0 1 0 0 0 .
C o m b in in g t h e r e s u lt s o f t h e in t e g r a l a n d fr a c t io n a l p a r t s ,
th e ex cess-3 c o d e fo r (2 3 7 .7 5 )₁₀ is 0 1 0 1 0 1 1 0 1 0 1 0 . 1 0 1 0 1 0 0 0 .
2 .F in d t h e d e c im a l n u m b e r o f e x c e s s - 3 n u m ber
1 1 0 0 1 0 1 0 0 0 1 1 .0 1 1 1 0 1 0 1
S o lu tio n :
B y s e p a r a t in g 4 b it s a s g r o u p t h e e q u iv a le n t e x c e s s - 3 code
is g iv e n a s 1100 1010 0 0 1 1 .0 1 1 1 0101
F lo r e n c e M . B a n a s ih a n Page 44
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
S u b t r a c t in g 0 0 1 1 fr o m ea ch fo u r - b it g r o u p , w e o b t a in th e
n ew n u m ber a s: 1001 0111 0 0 0 0 .0 1 0 0 0010.
T h e r e fo r e , t h e d e c im a l e q u iv a le n t is (9 7 0 .4 2 ) 1 0 .
3 . G R A Y C O D E
R u les :
a . B in a ry to G ra y C o d e C o n v ers io n :
1. T h e M o s t S ig n ific a n t B it (M S B ) o f t h e g r a y c o d e is a lw a y s e q u a l t o
th e M S B o f t h e g iv e n b in a r y c o d e .
2. O th er b it s of th e ou tp u t g ra y cod e ca n be o b t a in e d by X O R in g
b in a r y c o d e b it a t t h a t in d e x a n d p r e v io u s in d e x .
E x a m p le :
C o n v e r t t h e b in a r y n u m b e r 1 1 1 0 1 in t o G r a y C o d e .
S o lu tio n :
F lo r e n c e M . B a n a s ih a n Page 45
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
M o re ex a m p le:
T a b le 1 - 7 . G r a y C o d e e q u iv a le n t o f t h e D e c im a l 0 - 1 5 .
D E C IM A L B IN A R Y G R A Y
N U M B E R C O D E C O D E
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
F lo r e n c e M . B a n a s ih a n Page 46
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
b .G r a y C o d e to B in a r y C o n v e r s io n :
1. T h e M o s t S ig n ific a n t B it (M S B ) o f t h e b in a r y c o d e is a lw a y s e q u a l
to th e M S B o f t h e g iv e n b in a r y n u m b e r .
2. O t h e r b it s o f t h e o u t p u t b in a r y c o d e c a n b e o b t a in e d b y c h e c k in g
g r a y c o d e b it a t t h a t in d e x . If c u r r e n t g r a y c o d e b it is 0 , t h e n c o p y
p r e v io u s b in a r y c o d e b it , e ls e c o p y in v e r t o f p r e v io u s b in a r y c o d e
b it .
E x a m p le :
C on vert th e G ra y C od e 1 0 1 0 in t o B in a r y N u m b e r .
S o lu tio n :
P R O B L E M S E T 1 4
1 - 1 6 . C o n v e r t t h e g iv e n G r e y C o d e o f D e c im a ls 0 - 1 5 (a s s h o w n
in T a b le 1 - 7 in t o it s e q u iv a le n t B in a r y N u m b e r . Y o u m u s t
sh ow y o u r S O L U T IO N S .
F lo r e n c e M . B a n a s ih a n Page 47
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
2. S U M M A R Y
N ow t h a t y o u 'v e c o m p l e t e d t h is c h a p t e r , y o u s h o u ld h a v e a b a s ic
u n d e r s t a n d in g o f n u m b e r s y s t e m s . T h e n u m b e r s y s t e m s t h a t w e r e d e a lt
w it h a re u sed e x t e n s iv e ly in th e m ic r o p r o c e s s o r a n d com p u ter fie ld s .
T h e fo llo w in g is a s u m m a r y o f t h e e m p h a s iz e d t e r m s a n d p o in t s fo u n d
in th e "N u m b er S y stem s" ch a p ter.
T h e U N IT rep resen ts a s in g le o b je c t .
A N U M B E R is a s y m b o l u s e d t o r e p r e s e n t o n e o r m o r e u n it s .
T h e R A D I X is t h e b a s e o f a p o s it io n a l n u m b e r s y s t e m . It is e q u a l t o t h e
n u m b e r o f s y m b o ls u s e d in th a t n u m b er sy stem .
A P O S I T I O N A L N O T A T I O N is a s y s t e m in w h ic h t h e v a lu e o r m a g n it u d e
of a n u m b e r is d e fin e d n o t o n ly by it s d ig it s o r s y m b o l v a lu e , b u t a ls o
b y it s p o s it io n . E a c h p o s it io n rep resen ts a p o w e r o f t h e r a d ix , o r b a s e ,
a n d is r a n k e d in a s c e n d in g o r d e s c e n d in g order.
Th e M O S T S IG N IF IC A N T D IG IT (M S D ) is a d ig it w it h in a n u m ber
(w h o le o r fr a c t io n a l) t h a t h a s t h e la r g e s t e ffe c t (w e ig h in g p o w e r ) o n t h a t
n u m ber.
Th e L E A S T S IG N IF IC A N T D IG IT (L S D ) is a d ig it w it h in a n u m ber
(w h o le o r fr a c t io n a l) t h a t h a s t h e le a s t e ffe c t (w e ig h t in g p o w e r ) o n th at
n u m ber.
F lo r e n c e M . B a n a s ih a n Page 48
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
T h e B IN A R Y N U M B E R S Y S T E M is a b a s e 2 s y s t e m . T h e s y m b o ls 1 a n d
0 ca n be u sed to represen t t h e s t a t e o f e le c t r ic a l/ e le c t r o n ic d e v ic e s . A
b in a r y 1 m a y in d ic a t e t h e d e v ic e is a c t iv e ; a 0 m a y in d ic a t e t h e d e v ic e
is in a c t iv e .
Th e O C T A L N U M B E R S Y S T E M is a ba se 8 sy stem a n d is q u it e u s e fu l
a s a tool in th e c o n v e r s io n of b in a r y n u m bers. T h is sy stem w orks
3
beca u se 8 is a n in t e g r a l p o w e r of 2 ; t h a t is , 2 = 8. Th e u se of octa l
n u m b e r s r e d u c e s t h e n u m b e r o f d ig it s r e q u ir e d t o r e p r e s e n t t h e b in a r y
e q u iv a le n t o f a d e c im a l n u m b e r .
Th e H E X N U M B E R S Y S T E M is a b a s e 1 6 s y s t e m a n d is s o m e t im e s u s e d
in com p u ter sy stem s. A b in a r y n u m ber ca n b e con verted d ir e c t ly to a
b a s e 1 6 n u m b e r if t h e b in a r y n u m b e r is fir s t b r o k e n in t o g r o u p s o f fo u r
d ig it s .
Th e b a s ic r u le s of A D D IT IO N a p p ly to ea ch of th e n u m ber sy stem s.
E a ch sy stem b e c o m e s u n iq u e w h e n c a r r ie s a r e p r o d u c e d .
S U B T R A C T I O N in e a c h s y s t e m is b a s e d o n c e r t a in r u le s o f t h a t n u m b e r
sy stem . Th e borrow v a r ie s in m a g n it u d e a c c o r d in g to th e n u m ber
sy stem in u se. In m ost com p u ters, s u b t r a c t io n is a c c o m p lis h e d by
u s i n g t h e c o m p l e m e n t ( R 's o r R 's - 1 ) o f t h e s u b t r a h e n d a n d a d d i n g i t t o
t h e m in u e n d .
To C O N V E R T A W H O L E B A S E 1 0 N U M B E R t o a n o t h e r s y s t e m , d iv id e
t h e d e c im a l n u m b e r b y t h e b a s e o f t h e n u m b e r s y s t e m t o w h ic h y o u a r e
c o n v e r t in g . C o n t in u e d iv id in g t h e q u o t ie n t o f t h e p r e v io u s d iv is io n u n t il
it c a n n o lo n g e r b e d o n e . E x t r a c t t h e r e m a in d e r s - t h e r e m a in d e r fr o m
F lo r e n c e M . B a n a s ih a n Page 49
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
T o C O N V E R T D E C I M A L F R A C T I O N S , m u lt ip ly t h e fr a c t io n b y t h e b a s e
o f t h e d e s ir e d n u m b e r s y s t e m . E x t r a c t t h o s e d ig it s t h a t m o v e t o t h e le ft
of th e r a d ix p o in t . C o n t in u e to m u lt ip ly th e fr a c t io n a l p r o d u c t fo r a s
m a n y p la c e s a s n e e d e d . T h e fir s t d ig it le ft o f t h e r a d ix p o in t w ill b e t h e
M S D , a n d t h e la s t w ill b e t h e L S D . T h e e x a m p le t o t h e r ig h t s h o w s t h e
p r o c e s s o f c o n v e r t in g 2 4 8 .3 2 10 t o t h e o c t a l e q u iv a le n t (3 7 0 .2 4 3 8 ).
To C O N V E R T b in a r y , o c t a l, a n d h ex n u m bers to D E C IM A L u se th e
P O W E R S o f t h e b a s e b e in g c o n v e r t e d .
F lo r e n c e M . B a n a s ih a n Page 50
D C E E , C E IT
D ig ita l L o g ic a n d D e s ig n
E X C E S S -O F -T H R E E C O D E s a re u n w e ig h t e d a n d ca n be o b t a in e d by
a d d in g 3 t o e a c h d e c im a l d ig it t h e n it c a n b e r e p r e s e n t e d b y u s in g 4 - b it
b in a r y n u m b e r fo r e a c h d ig it . A n E x cess-3 e q u iv a le n t o f a g iv e n b in a r y
b in a r y n u m b e r is o b t a in e d u s in g t h e fo llo w in g s t e p s :
F in d t h e d e c im a l e q u iv a le n t o f t h e g iv e n b in a r y n u m b e r .
A d d + 3 to ea ch d ig it o f d e c im a l n u m b e r .
C o n v e r t t h e n e w ly o b t a in e d d e c im a l n u m b e r b a c k t o b in a r y n u m b e r
t o g e t r e q u ir e d e x c e s s - 3 e q u iv a le n t .
G R A Y C O D E is a n o r d e r in g o f t h e b in a r y n u m e r a l s y s t e m su ch th a t tw o
s u c c e s s iv e v a lu e s d iffe r in o n ly on e b it (b in a r y d ig it ). G r a y codes a re
v e r y u s e fu l in t h e n o r m a l s e q u e n c e o f b in a r y n u m b e r s g e n e r a t e d b y t h e
h a rd w a re th a t m a y ca u se a n e r r o r o r a m b ig u it y d u r in g t h e t r a n s it io n
fr o m on e n u m ber to th e n ext. S o, th e G ra y code ca n e lim in a t e t h is
p r o b le m e a s ily s in c e o n ly on e b it ch a n ges it s v a lu e d u r in g a n y
t r a n s it io n b e t w e e n tw o n u m b ers.
G r a y c o d e is n o t w e ig h t e d t h a t m e a n s it d o e s n o t d e p e n d on p o s it io n a l
v a lu e o f d ig it . T h is c y c lic v a r ia b le c o d e t h a t m e a n s e v e r y t r a n s it io n fr o m
o n e v a lu e t o t h e n e x t v a lu e in v o lv e s o n ly o n e - b it c h a n g e .
F lo r e n c e M . B a n a s ih a n Page 51
D C E E , C E IT