octal_hex.doc

Upload: debabrata-nag

Post on 07-Aug-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/20/2019 Octal_hex.doc

    1/22

     Addition of octal numbers:

    Addition of octal numbers is carried out by the same principle as that of decimal or binary numbers.

     An addition table for octal numbers is given below:

    + 0 1 2 3 4 5 6 7

    0 0 1 2 3 4 5 6 7

    1 1 2 3 4 5 6 7 10

    2 2 3 4 5 6 7 10 11

    3 3 4 5 6 7 10 11 12

    4 4 5 6 7 10 11 12 13

    5 5 6 7 10 11 12 13 14

    6 6 7 10 11 12 13 14 15

    7 7 10 11 12 13 14 15 16

    With the help of this table addition of octal numbers is best illustrated by the folloin! e"amples#

    Evaluate:

    $i% $162%& + $537% & 

    Solution:

      1 1 '(((( carry

      1 6 2

      5 3 77 2 1

    Therefore, sum = 7218

    $ii% $136% & + $636% & 

    Solution:

      1 '(((( carry

      1 3 6

      6 3 6

    7 7 4

    Therefore, sum = 7748

    1

  • 8/20/2019 Octal_hex.doc

    2/22

    $iii% $25.27% & + $13.2% &

    Solution:

      1 '(((( carry

      2 5 . 2 7

      1 3 . 24 0 . 4 7

    Therefore, sum = (40.47) 8

    $i)% $67.5% & + $45.6% &

    Solution:

      1 1 '(((( carry

      6 7 . 5

      4 5 . 6

    1 3 5 . 3

    Therefore, sum = (13.3) 8

    Subtraction of octal numbers:

    *imilarly subtraction of octal numbers can be performed by folloin! the rules of subtraction of decimal

    numbers.

    ,hus for performin! addition and subtraction of octal numbers e can follo the rules of addition and

    subtraction of decimal numbers

     ADDITION,SUBTRACTION, MULTIPLICATION AND DIVISIONOF OCTAL NUMBERS

    The addition and subtration o! ota" nu#ber are sho$n here% An a"ternati&e #ethod o! so"&in' thist()es o! )rob"e# is a"so disussed in this setion be"o$%

    OCTAL ADDITIONThe addition o! t$o or #ore ota" nu#bers an be ahie&ed b( !o""o$in' so#e s)ei!iru"es $hih are "isted be"o$% Sine there are ei'ht di'its in this s(ste# startin' !ro# *and the "ast di'it are +% The additions o! ota" nu#bers are disussed be"o$%

    % Add the ri'ht #ost di'its o! eah ota" nu#bers%

    2

  • 8/20/2019 Octal_hex.doc

    3/22

    -% Find the #odu"o o! the su# o! di'its #eans di&ide the su# b( . and there#ainder so obtained is the ota" e/ui&a"ent o! the su# and the /uotient isadded to the ne0t su# o! di'its !ro# ri'ht side% Per!or# the STEP - unti" $eadd the "e!t #ost di'its%

    Let us ta1e an e0a#)"e to ha&e a better idea ho$ the $ho"e o)eration ta1es )"ae%

    E0)23 Add the ota" nu#bers 4-56. and 47-+6.%

    Di'it 4Startin' !ro#Ri'ht6

    Re#ainder 8uotient

    59+:* *;.:- *E SUM OF T>E DIITS IS LESS T>AN . T>EN T>E MODULO OFT>E SUM @ILL BE T>E SUM ITSELF AND T>E 8UOTIENT @ILL BE ERO%E0)-23 Add the ota" nu#bers 45-7%6. and 4+-5%.6.%

    Di'its 4Startin' !ro#Ri'ht6

    Re#ainder 4Ota"E/ui&a"ent6

      8uotient

    9. : - -;. : -

  • 8/20/2019 Octal_hex.doc

    4/22

    E0)23 subtrat 4756. G 4-56.%

    B( usin' +s o#)"e#ent o! the subtrahend

    STEP 2 +s o#)"e#ent o! 4-56. : +++ G -5  : 4756.

    STEP -2 Add the nu#bers 4756. and 4756.%

    Di'its 4Startin' !ro#Ri'ht6

    Re#ainder 4Ota"E/ui&a"ent6

    8uotient

    595 : = =;. : = =

  • 8/20/2019 Octal_hex.doc

    5/22

    STEP -2 Add the #inuend 47+6. and .s o#)"e#ent o! subtrahend 45+6.%

    Di'its 4startin' !ro#ri'ht6

    Re#ainder 4Ota"E/ui&a"ent6

    8uotient

    9+ : ;. : 5 =

  • 8/20/2019 Octal_hex.doc

    6/22

    Di'its 4Startin' !ro#Ri'ht6

    Re#ainder 4Ota"E/ui&a"ent6

    8uotient

    59+:* *;.:- *

  • 8/20/2019 Octal_hex.doc

    7/22

    1. Multiply each digit of the octal number with its correspondingposition octal value and it start form left side as for first digit 8 !1" 81!8"82!#$" 8%!&12 and so on.

    2. 'dd all the numbers obtained form first step and that is the finaldecimal equivalent value of an octal number.

    (et us verify the above problem by this rule.

    )*ample:+ 'dd the octal numbers ,12%-8 and ,&2-8./olution:+ 0irst we change both the octal number into decimal number by aboverules.,12%-8 ! 1*8

    22*81%*8

      ! #$1#%  ! 8%  ! ,8%-1,&2-8 ! &*8

    22*81*8

      ! %21#

      ! %$%  ! ,%$%-1,8%-1,%$%-1 ! ,$2#-1No$ the ste) one has been e0euted% Thus $e $i"" start seond ste) as2 In the !irst ste)$e ha&e !ind the !ina" dei#a" &a"ue, no$ $e are 'oin' to han'e this dei#a" nu#ber into its e/ui&a"ent ota" nu#ber% The )roess o! a"terin' a dei#a" nu#ber into ota"nu#ber is done b( re)eated di&ision o! the dei#a" nu#ber b( . unti" the nu#ber beo#es "ess than .% The re#ainder !ound in eah di&ision to'ether !or#s the ota"nu#ber% The re#ainders are ta1en in order !ro# botto# to u)% Thus the ota" e/ui&a"ento! 4-=6* is as obtained2$2#8!&% 23

      &%8!# &3  #8! #34ence the octal equivalent is ,#&2-8. 'nd this is the final answer in octal number system.,12%-8  ,&2-8 ! ,#&2-8Si#i"ar"( an( ota" nu#bers an be added b( this #ethod% No$ $e $i"" disuss about the subtration o! ota"nu#ber in the sa#e )roedure% The subtrations o! ota" nu#bers are i""ustrated be"o$$ith )ro)er e0a#)"e%

    )*ample:+ /ubtract the octal number ,$&%-8 and ,2%$-8./olution:+ The subtraction process will be processed in the same way as theaddition is performed above. 5ow we change the octal numbers ,$&%-8 and,2%$-8 into decimal numbers.,$&%-8 ! $*8

    2&*81%*8

      ! 2$%  ! 266  ! ,266-1,2%$-8 ! 2*8

    2%*81$*8

      ! 1282$$

    7

  • 8/20/2019 Octal_hex.doc

    8/22

      ! 1  ! ,1-1 ,266-1 7 ,1-1 ! ,1$%-1/ince the first step is complete now so we will go for the ne*t step to change thedecimal value into octal value.

    1$%8 ! 1 3  18 ! 2 13  28 ! 23The octal equivalence of ,1$%-1 is ,21-8.4ence the result is ,$&%-8 7 ,2%$-8 ! ,21-8.

    MULTIPLICATION AND DIVISION OF OCTAL NUMBERS

    Multiplication and ivision of octal number can also be achieved by this methodeasily. To ta9e a good understanding let us go through an e*ample:)*ample:+ Multiply the octal number ,$88-8 and ,&&&-8.

    /olution:+ let us change the numbers into decimal number system.,$88-8 ! $*8

    28*818*8

      ! 2#$8  ! %28  ! ,%28-1,&&&-8 ! &*8

    2&*81&*8

      ! %2$&  ! %#&  ! ,%#&-1,%28-1,%#&-1 ! ,1162-15ow change ,1162-1 into octal equivalent.

    11628 ! 1$6#&3  1$6#&8 ! 18 &3  188 ! 2%% #3  2%%8 ! 26 13  268 ! % &3  %8 ! %34ence the octal equivalent is ,%&1#&-8.There!ore 4..6.47776. : 457=7*6.

    8

  • 8/20/2019 Octal_hex.doc

    9/22

    Ota" AdditionFo""o$in' ota" addition tab"e $i"" he") (ou to hand"e ota" addition%

    To use this tab"e, si#)"( !o""o$ the diretions used in this e0a#)"e2 Add = . and 7.% Loate = in the A o"u#n

    then "oate the 7 in the B o"u#n% The )oint in Jsu#J area $here these t$o o"u#ns interset is the Jsu#J o! 

    t$o nu#bers%

    68 + 58 = 138.

    E0a#)"e K Addition

    Ota" SubtrationThe subtration o! ota" nu#bers !o""o$s the sa#e ru"es as the subtration o! nu#bers in an( other nu#ber 

    s(ste#% The on"( &ariation is in borro$ed nu#ber% In the dei#a" s(ste#, (ou borro$ a 'rou) o! * *% In the

    binar( s(ste#, (ou borro$ a 'rou) o! -*% In the ota" s(ste# (ou borro$ a 'rou) o! .*%

    9

  • 8/20/2019 Octal_hex.doc

    10/22

    E0a#)"e K Subtration

    >e0adei#a" Nu#ber S(ste#Fo""o$in' are the harateristis o! a he0adei#a" nu#ber s(ste#%

    • Uses * di'its and = "etters, *,,-,5,,7,=,+,.,,A,B,C,D,E,F%

    Letters re)resents nu#bers startin' !ro# *% A : *, B : , C : -, D : 5, E : , F : 7%

    •  A"so a""ed base = nu#ber s(ste#%

    • Eah )osition in a he0adei#a" nu#ber re)resents a * )o$er o! the base 4=6% E0a#)"e K =*

    • Last )osition in a he0adei#a" nu#ber re)resents an 0 )o$er o! the base 4=6% E0a#)"e K = 0 $here

    0 re)resents the "ast )osition 3 %

    E0a#)"e

    >e0adei#a" Nu#ber K FDE=

    Ca"u"atin' Dei#a" E/ui&a"ent K

    /tep ;inary 5umber ecimal 5umber 

    Ste) FDE= 44 =6 9 4 =56 9 4F =-6 9 4D =6 9 4E =*66*

    Ste) - FDE= 44 =6 9 4 =56 9 47 =-6 9 45 =6 9 4 =*66*

    Ste) 5 FDE= 4=775= 9 5=.= 9 5.* 9 -*. 9 6*

    Ste) FDE= *==-*

    5ote

  • 8/20/2019 Octal_hex.doc

    11/22

    >e0adei#a" AdditionFo""o$in' he0adei#a" addition tab"e $i"" he") (ou 'reat"( to hand"e >e0adei#a" addition%

    To use thistab"e, si#)"(

    !o""o$ the

    diretions

    used in this

    e0a#)"e K

     Add A= and

    7=% Loate A

    in the

    o"u#n then

    "oate the 7

    in the

    o"u#n% The

    )oint in Jsu#J

    area $here

    these t$o

    o"u#ns

    interset is

    the su# o! t$o nu#bers%

    A16 + 516 = F16.

    E0a#)"e K Addition

    >e0adei#a" SubtrationThe subtration o! he0adei#a" nu#bers !o""o$ the sa#e ru"es as the subtration o! nu#bers in an( other 

    nu#ber s(ste#% The on"( &ariation is in borro$ed nu#ber% In the dei#a" s(ste#, (ou borro$ a 'rou) o! * *%

    In the binar( s(ste#, (ou borro$ a 'rou) o! -*% In the he0adei#a" s(ste# (ou borro$ a 'rou) o! =*%

    E0a#)"e 3 Subtration

    11

  • 8/20/2019 Octal_hex.doc

    12/22

    4e*adecimal 'ddition

    Dei#a" basi one)ts2

    Dei#a" is base *%

    There are * di'its in ountin' 4*, , -, 5, , 7, =, +, ., 6

    @hen (ou reah *, (ou arr( a o&er to the ne0t o"u#n

    The nu#ber a!ter is *

    >e0adei#a" basi one)ts2

    >e0adei#a" is base =%

    There are = di'its in ountin' 4*, , -, 5, , 7, =, +, ., , A, B, C, D, E, F6

    @hen (ou reah =, (ou arr( a o&er to the ne0t o"u#n

    The nu#ber a!ter F 4dei#a" 76 is * in he0 4or = in dei#a"6

    Use the !o""o$in' ste)s to )er!or# he0adei#a" addition2

    % Add one o"u#n at a ti#e%

    -% Con&ert to dei#a" and add the nu#bers%

    5a% I! the resu"t o! ste) t$o is = or "ar'er subtrat the resu"t !ro# = and arr( to the ne0t

    o"u#n%

    5b% I! the resu"t o! ste) t$o is "ess than =, on&ert the nu#ber to he0adei#a"%

    )*ample: ,=se the color code in each step to see what>s happening-

    12

  • 8/20/2019 Octal_hex.doc

    13/22

    The )rob"e#2

    ou are to add these nu#bers2

     A C 7 A

    E D =

    Carr( O&er2

    % Add one o"u#n at a ti#e

    -% Con&ert to dei#a" add 46 9 $ : 1%6

    5% Fo""o$ "ess than = ru"e

    Dei#a" 1% is he0adei#a"

     A C 7 A 6

    E D = $

    Carr( O&er2 1

    % Add ne0t o"u#n

    -% Con&ert to dei#a" add 41 9 6 : 166

    5% Fo""o$ = or "ar'er than = ru"e

    416 G = : % arr( a 16

     A C 7 '

    E D = 6

    % D

    Carr( O&er2 1

    % Add ne0t o"u#n

    -% Con&ert to dei#a" add 41 9 7 9 = : 126

    5% Fo""o$ "ess than = ru"e, on&ert to he0

    Dei#a" - is he0adei#a" C

     A C &  A

    E D #

    C 5 D

    Carr( O&er2 1

    % Add ne0t o"u#n A C 7 A

    13

  • 8/20/2019 Octal_hex.doc

    14/22

    -% Con&ert to dei#a" add 412 9 1% : 2&6

    5% Fo""o$ = or "ar'er than = ru"e

    42& G = : 6 arr( a 16

    E =

    6 C 5 D

    Carr( O&er2 1

    % Add ne0t o"u#n

    -% Con&ert and add 41 9 1 9 11 : 226

    5% Fo""o$ = or "ar'er than = ru"e

    422 G = : # arr( a 16

    ' C 7 A

    ; D =

    # C 5 D

    Carr( O&er2 1

    % Add ne0t o"u#n

    -% Con&ert and add 41 9 * 9 * : 16

    5% Fo""o$ "ess than = ru"e

    * A C 7 A

    * B D =

    1 = C 5 D

    )*ample: Add =F= 9 A-=%

      1 1 Q Carried o&er di'its

      = F

      9 A -

      3333333333333333

      =

      33333333333333333

    The di'its in unitJs )"ae F are -% Fro# the tab"e, F 9 - : = !ro# $hih is $ritten in unitJs )"ae and is

    arried o&er to the ne0t hi'her 4=6 )"ae%

    The di'its in =Js )"ae are added as

    9 = 9 A : + 9 A : = 4Fro# tab"e6 out o! $hih, is $ritten do$n as su# and is arried to the ne0t hi'her

    4=-6 )"ae%

    The di'its in =- Js )"ae add as 9 9 : ==%

    Thus 1#01#  $'21# ! #111#%

    4e*adecimal /ubtraction:

    The ru"e to be re#e#bered !or subtration is the di'it borro$ed !ro# the i##ediate hi'her )"ae is ounted as

    =%

    14

  • 8/20/2019 Octal_hex.doc

    15/22

    )*ample: Subtrat BA= !ro# C5=%

      16 16 Q Borro$ed

      B 2 Q Re#ainin' di'it a!ter borro$in'

      C 5

      3 B A

      333333333333333333

      E F

      3333333333333333333

    In units )"ae, A the bi''er nu#ber is to be subtrated !ro# % So, di'it !ro# =Js )"ae is borro$ed and = 9

    : -7%

     A is subtrated !ro# -7%

    -7 3 A= : F= 4Note the &a"ues o! A and F are * and 76%

     As is borro$ed !ro# 5, no$ !or the ne0t )"ae is to be subtrated !ro# -% This a'ain re/uires borro$in'

    !ro# the ne0t hi'her )"ae%

    = 9 - 3 : . 3 : E=%

    No$, !or the ne0t )"ae, B is to B subtrated !ro# B re#ainin' a!ter "endin' % B 3 B : *%

    Thus C%61# + ;$'1# + ! )01#.

    4e*adecimal Multiplication:

    The !o""o$in' tab"e 'i&es )roduts o! a"" o#binations o! t$o sin'"e di'its%

    @hi"e #u"ti)"(in', i! the )rodut onsists o! t$o di'its, the di'it on the "e!t is arried o&er and added to the

    )rodut in the ne0t )"ae%

    )*ample:

    Find the )rodut o! A.= and AF=%

    15

  • 8/20/2019 Octal_hex.doc

    16/22

      6 5 Q Di'its arried o&er in seond #u"ti)"iation

      9 7 Q Di'its arried o&er in !irst #u"ti)"iation%

      A .

      0 A F

      333333333333333

      . D .

      * * *

      33333333333333333333333333

      - D .

      333333333333333333333333333

    First the di'it F in the nu#ber AF= is #u"ti)"ied $ith eah o! the di'its in the nu#ber A.=%

    F 0 . : +.%

    The di'it . is $ritten be"o$ in the )rodut ro$ and + is arried o&er to the ne0t )"ae to be added $ith the ne0t

    )rodut%

    F 0 A : ==

    and == 9 += : D=%

    D is $ritten in the )rodut ro$ and is arried o&er to the ne0t )"ae

    F 0 : F%

    and F= 9 = : .= %

    The seond ro$ o! #u"ti)"iation is done in a si#i"ar #anner, b( #u"ti)"(in' the di'it A $ith eah o! the di'its in

    A.=%

    The t$o )roduts are then added to 'et the !ina" )rodut%

    Thus 1'81#  * '01# ! 12181#%

    ?uestion %: Add FA= 9 5D=%

    /olution:

     

    The addition ste)s are e0)"ained be"o$ sho$in' tab"e used !or he0adei#a" addition%

    16

  • 8/20/2019 Octal_hex.doc

    17/22

      1 1 Carried Over Digits.

      F 4 A+ 3 D 9

    -----------------

      1 3 2 3

    -----------------

     

    The addition tab"e is used to deter#ine the su# o! t$o di'its% I! the su# sho$s t$o di'its in the tab"e, the "e!t

    di'it is arried o&er to the i##ediate hi'her )"ae and added $ith the di'its in that )"ae% The su#s A 9 : 5,

    9 9 D : 7 9 D : - and 9 F 9 5 : 9 F : 5 are hi'h"i'hted in the tab"e%

    I! the su# is !ound b( $ritin' the di'its in dei#a" !or# A= 9 = : ** 9 * : *% = in is arried o&er as

    to the i##ediate hi'her )"ae, and the re#ainder 5 is $ritten as su# !or that )"ae%

    >ene 0$'1#  %61# ! 1%2%1#%

     

    ?uestion $: Find the )rodut o! A5=  and FD=%

    /olution:

     

     As addition, a #u"ti)"iation tab"e is used !or !indin' the )rodut o! t$o he0adei#a" di'its%

    17

  • 8/20/2019 Octal_hex.doc

    18/22

      3 8 Digits

    carried over in second

    multiplication by F 

      2 7 Digitscarried over in first

    multiplication by D

      A 3 9X F D

      --------------

      8 4 E 5

     9 9 5 7 0----------------------

     A 1 A 5 5

    ----------------------

     

    The )roduts used !or #u"ti)"iation D 0 : +7, D 0 5 : -+, D 0 A : .-, F 0 : .+, F 0 5 : -D and F 0 A : =

    are hi'h"i'hted in the Mu"ti)"iation tab"e%

    For eah )rodut, the di'it on the ri'ht is $ritten in the )rodut ro$ and the di'it on the "e!t is arried o&er to the

    ne0t )"ae%

    The di'it arried o&er is added to the )rodut 'ot !or the di'it in that )"ae%

    The t$o )roduts obtained !or D and F $ith A5= is then added%

    This A5= 0 FD= : AA77=%

    Octal Number Multiplication:-

    18

  • 8/20/2019 Octal_hex.doc

    19/22

    In multiplication of octal numb!" a "impl !ul fo! multiplication of t#o $i%it" in an& !a$i' i" to

    multipl& t(m in $cimal. If t( p!o$uct i" l"" t(an t( !a$i') t(n # ta* it a" t( !"ult. If t(

     p!o$uct i" %!at! t(an t( !a$i' # $ii$ it b& t( !a$i' an$ ta* t( !main$! a" t( la"t"i%nificant $i%it. ,( uotint i" ta*n a" ca!!& in t( n't "i%nificant $i%it.

    -or e"ample $3%4  $1%4 / $3%4 but $3%4  $2%4 / $12%4 since 3 2 / 6 is decimal and di)ision of 6 by 4has the remainder 2 and uotient 1.

    ,o multipl& t#o octal numb!" # u" t( !ul %in abo. ,( p!oc"" fo! multiplication of

    octal numb!" i" illu"t!at$ #it( t( (lp of t( follo#in% 'ampl"

    Evaluate:

    $i% 6&  23&

    Solution:

    We ha)e 6 3 / 1& in decimal hich hen di)ided by & !i)es a remainder 2 and carry 2. A!ain 6 2 / 12in decimal and 12 + 2 / 14. ,his hen di)ided by & !i)es a remainder 6 and a carry 1.

    !en"e #8 $ 238 = 1#28 6 3 / 1&

    1&& / 2 ith remainder 2  lsd

    6 2 / 12 + 2 $carry% / 14

    14& / 1 ith remainder 6.

    $ii% 15&  44& 

    Solution:

    *ince 15& / 7& + 6& We rite

    15&  44& / $7& + 6&% 44& / 7&  44& + 6&  44&

    o 7 44 / 374

    6 44 / 330

    ,ain! octal addition e ha)e 374& + 330& / 724&

    !en"e 18 % 448 = 7248

    OCTAL MULTIPLICATION

    19

  • 8/20/2019 Octal_hex.doc

    20/22

     We multiply the numbers as they are. However ! "i#it or $

    "i#it pro"u%ts will still remain in one %olumn. As you %an see when we multiplie" & by ' we write a $( below. Not( %arry $. )o the *ollowin# *or ! times ' to #et +! an" so on.

    Ne,t we a"" the numbers. $( - ( is $(. +! - & is +. ( - !

    is !. /ums are still on in"ivi"ual %olumns.

    20

    http://2.bp.blogspot.com/_cxFlBuNbRQ8/SxvWSr0uP3I/AAAAAAAAAEk/jFMn48ADsDY/s1600-h/octalmult2.jpghttp://2.bp.blogspot.com/_cxFlBuNbRQ8/SxvWS1mNmsI/AAAAAAAAAEs/8OBFZTCl-Hs/s1600-h/octalmult1.jpg

  • 8/20/2019 Octal_hex.doc

    21/22

    Here0s the tri%1y part. /in%e we0re "ealin# with the o%tal number system 2 3 4 we have to *in" multiples o* 3

    %losest to ea%h "i#it. These are ( 3 +' !5 $! 5( 53 an" so on...6or $( the %losest woul" be $ , 3 7 !5. /o

    subtra%t $( by !5 to #et '. Carry the $ over to the se%on" "i#it.

    The number we carry over is determined by the number of 8's we had to subtract from 30 to get a difference of

    less than 8. I.E 30 - 8 = - 8 = !" - 8 = #. $e subtracted 30 by 8 three times so we add 3 to the digit before. %r it

    is sim&ly the number we multi&ly by 8 to get the number closest to 30.

    + - $ is !(. The multiple 2 o* 3 4 %losest to !( is +'. /o we subtra%t !( by +' to #et 5 an" %arry over a ! to the $r"

    "i#it.

    21

    http://4.bp.blogspot.com/_cxFlBuNbRQ8/SxvWSOqebII/AAAAAAAAAEU/DATFmxzzQfQ/s1600-h/octalmult4.jpghttp://4.bp.blogspot.com/_cxFlBuNbRQ8/SxvWSY_ZF9I/AAAAAAAAAEc/Rfg24t8iuVw/s1600-h/octalmult3.jpg

  • 8/20/2019 Octal_hex.doc

    22/22

    ! - ! is 5 . /in%e this is less than 3 this woul" be the *inal answer.

    22