Page 11 - DCAP104_EXPOSURE_TO_COMPUTER_DISCPLINES
P. 11

Exposure to Computer Disciplines



                   Notes         1.2 Data Representation in Computer

                                 Introduction data representation considers how a computer uses numbers to represent data inside
                                 the computer. Three types of data are considered at this stage: 1. Numbers including positive,
                                 negative and fractions. 2. Text. 3. Graphics.

                                 1.2.1 Decimal Representation in Computers
                                 The binary number system is most natural for computer because of the two stable states of
                                 its components. But, unfortunately, this is not a very natural system for us as we work with
                                 decimal number system. Then how does the computer do the arithmetic? One of the solutions,
                                 which are followed in most of the computers, is to convert all input values to binary. Then the
                                 computer performs arithmetic operations and finally converts the results back to the decimal
                                 number so that we can interpret it easily. Is there any alternative to this scheme? Yes, there
                                 exist an alternative way of performing computation in decimal form but it requires that the
                                 decimal numbers should be coded suitably before performing these computations. Normally,
                                 the decimal digits are coded in 6-8 bits as alphanumeric characters but for the purpose of
                                 arithmetic calculations the decimal digits are treated as four bit binary code. As we know 2
                                 binary bits can represent 2’ = 4 different combination, 3 bits can represent 23 = 8 combination
                                 and 4 bits can represent 24 = 16 combination. To represent decimal digits into binary form
                                 we require 10 combinations only, but we need to have a 4-digit code. One of the common
                                 representations is to use first ten binary combinations to represent the ten decimal digits.
                                 These are popularly known as Binary Coded Decimals (BCD). The following representation
                                 shows the binary coded decimal numbers. Let us represent 43.125 in BCD. It is 0 100 00 1
                                 1.000 1 .00 10 01 0 1

                                                 Decimal                         Binary Coded Decimal
                                                     0                                   0000
                                                     1                                   0001
                                                     2                                   0010
                                                     3                                   0011
                                                     4                                   0100
                                                     5                                   0101
                                                     6                                   0110

                                                     7                                   0111
                                                     8                                   1000
                                                     9                                   1001
                                                    10                               0001 0000
                                                    11                               0001 0001
                                                    12                               0001 0010
                                                    13                               0001 0011

                                                     ..                                  ........
                                                    20                               0010 0000
                                                     ..                                  ........
                                                    30                              0011  0000




        4                                 LOVELY PROFESSIONAL UNIVERSITY
   6   7   8   9   10   11   12   13   14   15   16