Page 284 - FUNDAMENTALS OF COMPUTER
P. 284

NPP













                   284                         Fundamentals of Computers                           NPP


                      +17 can  be represented in  8-bit  signed-  (+17) H$mo 8-{~Q> gmBÝS> _op½ZQ²>`yS> _| BgàH$ma
                  magnitude form  as  00010001. The represen-  {bIm Om gH$Vm h¡ … 00010001. (-26) H$mo àmá
                  tation of –26 can be obtained from that of +26
                  (00011010) by taking two's complement of it :  H$aZo Ho$ {bE nhbo (+ 26) H$m Vwë` àmá H$aVo h¢ Omo
                                                              Bg àH$ma h¡… 00011010 A~ Bg g§»`m H$m 2's
                                                              H$m°påßb_|Q> boZo na (-26) H$m Vwë` àmá hmoVm h¡ Omo Bg
                                                              àH$ma h¡… 11100110
                                                      –26 →11100110
                      Now, adding both the numbers:               XmoZm| g§»`mAm| H$mo Omo‹S>Zo na…

                                           +  17 →       0001 0 00 1
                                           −  26 →+      11 10 0 1 1 0
                                                         1 1 1 10 11 1
                      Since MSB  is  1  the result is a negative  MSB Ho$ ñWmZ na 1 h¡ Omo ~VmVm h¡ {H$ n[aUm_
                  integer whose actual value can be obtained by  F$UmË_H$ h¡ Am¡a `h gmBÝS> 2's H$m°påßb_|Q> _| Xem©`m
                  taking 2's complement of 11110111. This comes  J`m h¡ Ÿ& BgH$m dmñV{dH$ _mZ 2's H$m°påßb_|Q> boZo na
                  as –00001001 which is –9 in decimal. Thus, the
                  result can be written as :                  OmZm Om gH$Vm h¡ Ÿ& Omo Bg àH$ma hmoJm- 00001001
                                                              `h Xe_bd _| - 9 h¡ Ÿ& AV… h_ {bI gH$Vo h¢ {H$…

                                                      (+17) + (–26) = (–9)
                      Note that (–9) will be saved in computer as  ܶmZ aho {H$ H§$ß¶yQ>a ‘|  (-9) H$mo 11110111
                  11110111.                                   Ho$ ê$n ‘| hr god H$a|Jo&

                      Similarly we can perform addition if both   {~ëHw$b Bgr Vah go Xmo F$UmË_H$ g§»`mAm| H$m `moJ
                  the numbers are negative. Just add after proper  àmá H$a gH$Vo h¢Ÿ& g_w{MV ê$n go Vwë` {bIm| VWm
                  representation and neglect any end carry.
                                                              Omo‹S>H$a hm{gb H$mo N>mo‹S> XmoŸ&
                  Overflow                                    Amodaâbmo
                      Sometimes the result cannot be fitted into  H$^r-H$^r Cn`moJ H$s JB© {~Q>m| H$s g§»`m _| n[aUm_
                  the number of bits used. In that case the result  g_m{hV Zht hmo nmVm h¡Ÿ& V~ n[aUm_ H$m _mZ VWm {MÝh
                  has  a different magnitude and sign than  the
                  desired. The points to be noted for  overflow  dmñV{dH$ go AbJ AmVm h¡Ÿ& Bg pñW{V H$mo Amodaâbmo
                  condition are:                              H$hVo h¢Ÿ& {H$Ýht Xmo gmBÝS> nyUmªH$m| H$mo Omo‹S>Zo na BZ Xmo
                                                              pñW{V`m| _| hr Amoìhaâbmo hmoVm h¡ …
                  1.  When both the integers are of same sign.  1. XmoZm| g§»`mAm| Ho$ {MÝh g_mZ hmoŸ& Am¡a
                      and
                  2.  Carry-in to the sign bit is different from  2. gmBZ {~Q> na AmZo dmbm hm{gb (C ) VWm BZgo
                                                                                             in
                      carry-out to the sign bit.                  ~mha OmZo dmbm hm{gb C  XmoZm| AbJ-AbJ  hmoŸ&
                                                                                    out
                      These two concepts are used by computer     BZ Xmo pñW{V`m| go H$åß`yQ>a Amodaâbmo H$m nVm
                  circuit to detect the condition for overflow. For  bJmVm h¡& bo{H$Z h_ Vmo AmgmZr go Amodaâbmo H$s pñW{V
   279   280   281   282   283   284   285   286   287   288   289