Page 27 - computer science (868) class 11
P. 27

0
                                                                           2
                   0001     1001     0001      .      0001       8 (2 )  4 (2 )  2 (2 )  1 (2 )          Hexa
                                                                                  1
                                                                    3
                     1       9        1        .        1         0       0      0      1     0 × 8 + 0 × 4 + 0 × 2 + 1 × 1 = 1
                                                                  1       0      0      1     1 × 8 + 0 × 4 + 0 × 2 + 1 × 1 = 9
                                                                  0       0      0      1     0 × 8 + 0 × 4 + 0 × 2 + 1 × 1 = 1
                 (191.1) 16                                       0       0      0      1     0 × 8 + 0 × 4 + 0 × 2 + 1 × 1 = 1
                 Example 3:  Convert (25C9)  to octal.
                                         16
                 Answer: Converting Octal to Binary first

                                                                                   1
                                                                           2
                                                                    3
                      2          5        C(12)       9          8 (2 )  4 (2 )  2 (2 )  1 (2 )          Hexa
                                                                                          0
                    0010       0101       1100       1001         0       0      1       0     0 x 8 + 0 x 4 + 1 x 2 + 0 x 1 = 2
                 Binary equivalent is (0010010111001001)          0       1      0       1     0 x 8 + 1 x 4 + 0 x 2 + 1 x 1 = 5
                                                      2
                 Grouping 3 bits, we get 10  010  111  001  001   1       1      0       0    1 x 8 + 1 x 4 + 0 x 2 + 0 x 1 = 12
                 Converting to Octal                              1       0      0       1     1 x 8 + 0 x 4 + 0 x 2 + 1 x 1 = 9

                    010     010      111      001      001        4 (2 )    2 (2 )   1 (2 )             Octal
                                                                               1
                                                                     2
                                                                                        0
                     2       2        7        1        1           0        1         0         0 × 4 + 1 × 2 + 0 × 1 = 2
                                                                    1        1         1         1 × 4 + 1 × 2 + 1 × 1 = 7
                                                                    0        0         1         0 × 4 + 0 × 2 + 1 × 1 = 1
                 (22711) 16                                         0        0         1         0 × 4 + 0 × 2 + 1 × 1 = 1

                     1.3 BINARY ARITHMETIC
                 The  arithmetic  of  binary numbers involves binary addition,  binary subtraction,  binary multiplication,  and  binary
                 division. Like decimal arithmetic, binary arithmetic operations start from its rightmost least significant bit.

                 1.3.1 Binary Addition
                 The basic cases for Binary addition are:

                                      Bits         Sum          Carry
                                     0 + 0           0            0
                                     0 + 1           1            0
                                     1 + 0           1            0

                                     1 + 1           0            1       Added to the adjacent left bits
                                    1 + 1 + 1        1            1       Added to the adjacent left bits
                 Let us understand with some examples.
                 Example 1: (1100111)  + (11101) 2     +1 +1 +1 +1 +1 +1 +1
                                    2
                 Answer:                                   1   1   0   0   1   1   1
                                                       +           1   1   1   0   1

                 (10000100)                            1   0   0   0   0   1   0   0
                           2
                 Example 2: (10111.11)  + (1101.01)
                                     2          2
                 Answer:                              +1 +1 +1 +1 +1 +1        +1
                                                           1   0   1   1   1 . 1   1
                                                       +       1   1   0   1 . 0   1
                 (100101.00) 2                         1   0   0   1   0   1 . 0   0



                                                                                                                        25
                                                                                                            Numbers     25
   22   23   24   25   26   27   28   29   30   31   32