Upcoming SlideShare
×

# Chapter1b

1,084 views

Published on

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,084
On SlideShare
0
From Embeds
0
Number of Embeds
61
Actions
Shares
0
58
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Chapter1b

1. 1. Chapter 1DATA REPRESENTATION
2. 2. Number Systems Number system Base Coefficients Decimal 10 0–9 Binary 2 0,1 Octal 8 0–7 Hexadecimal 16 0 – 9, A – F
3. 3. Binary Shop
4. 4. Base conversion• From any base-r to Decimal• From Decimal to any base-r• From Binary to either Octal or Hexadecimal• From either Octal or Hexadecimal to Binary
5. 5. Binary to octal or hexadecimalBinary To Octal Procedure: • Partition binary number into groups of 3 digits Example: • (10110001101011.111100000110)2 = ______________ 8
6. 6. Binary to octal or hexadecimal10 110 001 101 011 . 111 100 000 110 2
7. 7. Binary to octal or hexadecimal10 110 001 101 011 . 111 100 000 110 2 2 6 1 5 3 . 7 4 0 6 8
8. 8. Binary to octal or hexadecimalBinary To Hexadecimal Procedure: • Partition binary number into groups of 4 digits Example: • (10110001101011.11110010)2 = ______________ 16
9. 9. Binary to octal or hexadecimal10 1100 0110 1011 . 1111 0010 2
10. 10. Binary to octal or hexadecimal10 1100 0110 1011 . 1111 0010 2 2 C 6 B . F 2 16
11. 11. Octal or hexadecimal to binaryOctal To Binary Procedure: • Each octal digit is converted to its 3- digit binary equivalent Example: (673.124)8 = _____ 2
12. 12. Octal or hexadecimal to binary 6 7 3 . 1 2 4 8
13. 13. Octal or hexadecimal to binary 6 7 3 . 1 2 4 8110 111 011 . 001 010 100 2
14. 14. Octal or hexadecimal to binaryHexadecimal to Binary Procedure: • Each hexadecimal digit is converted to its 4-digit binary equivalent Example: (306.D)16 = _____ 2
15. 15. Octal or hexadecimal to binary 3 0 6 . D 16
16. 16. Octal or hexadecimal to binary 3 0 6 . D 16 0011 0000 0110 . 1101 2
17. 17. Any Other Number System• In general, a number expressed in base-r hasr possible coefficients multiplied by powers ofr:anrn + an-1rn-1 + an-2rn-2 +...+ a0r0 + a-1r-1 + a-2r-2 + ... + a-mr-mwhere n = position of the coefficient coefficients = 0 to r-1
18. 18. ExampleBase 5 number coefficients: 0 to r-1 (0, 1, 2, 3, 4)• (324.2)5
19. 19. ExampleBase 5 number coefficients: 0 to r-1 (0, 1, 2, 3, 4)• (324.2)5 = 3 x 52 + 2 x 51 + 4 x 50 + 2 x 5-1 = 89.410
20. 20. ExampleBase 5 number coefficients: 0 to r-1 (0, 1, 2, 3, 4)• (324.2)5 = 3 x 52 + 2 x 51 + 4 x 50 + 2 x 5-1 = 89.410• (4021)5
21. 21. ExampleBase 5 number coefficients: 0 to r-1 (0, 1, 2, 3, 4)• (324.2)5 = 3 x 52 + 2 x 51 + 4 x 50 + 2 x 5-1 = 89.410• (4021)5 = 4 x 53 + 0 x 5 2 + 2 x 5 1 + 1 x 5 0 = 51110
22. 22. Fixed-Point RepresentationUnsigned Number  leftmost bit is the most significant bit  Example: • 01001 = 9 • 11001 = 25
23. 23. Fixed-Point RepresentationUnsigned Number Signed Number  leftmost bit is the  leftmost bit most significant bit represents the sign  Example:  Example: • 01001 = 9 • 01001= +9 • 11001 = 25 • 11001= - 9
24. 24. Systems Used to Represent Negative NumbersSigned-Magnitude Representation  A number consists of a magnitude and a symbol indicating whether the magnitude is positive or negative.Examples: +85 = 010101012 -85 = 110101012 +127 = 011111112 -127 = 111111112
25. 25. Systems Used to Represent Negative NumbersSigned-Complement System• This system negates a number by taking its complement as defined by the system.• Types of complements: – Radix-complement – Diminished Radix-complement
26. 26. Complements• Diminished Radix • Radix Complement Complement General Formula: General Formula: r’s C of N = rn - N (r-1)’s C of N = (rn - r-m) - N where where n = # of bits n = # of digits (integer) r = base/radix m = # of digits (fraction) N = the given # in r = base/radix base-r N = the given # in base-r
27. 27. ComplementsExamples 9’s C • 012390 = 987609 • 54670.5 = 45329.4 10’s C • 012390 = 987610 • 54670.5 = 45329.5
28. 28. ComplementsExamples Examples 9’s C  1’s C • 012390 = 987609 • 1101100 = 0010011 • 54670.5 = 45329.4 • 0110111 = 1001000 10’s C  2’s C • 012390 = 987610 • 1101100 = 0010100 • 54670.5 = 45329.5 • 0110111 = 1001001
29. 29. Binary CodesCode – a set of n-bit strings in which differentbit strings represent different numbers orother things.Binary codes are used for:  Decimal numbers  Character codes
30. 30. Binary codes for decimal numbersAt least four bits are needed to representten decimal digits.Some binary codes:  BCD (Binary-coded decimal)  Excess-3  Biquinary
31. 31. Binary codes for decimal numbersBCD Excess-3 Code straight assignment  unweighted code  BCD + 3 of the binary equivalent weights can be Biquinary Code  seven-bit code with assigned to the error detection binary bits according properties to their position  each decimal digit consists of 5 0’s and 2 1’s
32. 32. Binary codes for the decimal digits Decimal BCD Excess-3 84-2-1 2421 Biquinary Digit 8421 5043210 0 0000 0011 0000 0000 0100001 1 0001 0100 0111 0001 0100010 2 0010 0101 0110 0010 0100100 3 0011 0110 0101 0011 0101000 4 0100 0111 0100 0100 0110000 5 0101 1000 1011 1011 1000001 6 0110 1001 1010 1100 1000010 7 0111 1010 1001 1101 1000100 8 1000 1011 1000 1110 1001000 9 1001 1100 1111 1111 1010000
33. 33. Differences between Binary and BCD• BCDis not a number system• BCD requires more bits than Binary• BCD is less efficient than Binary• BCD is easier to use than Binary
34. 34. Coding vs ConversionConversion  bits obtained are binary digits  Example: 13 = 1101Coding  bits obtained are combinations of 0’s and 1’s  Example: 13 = 0001 0011
35. 35. Character CodeAmerican Standard Extended BinaryCode for Information Coded DecimalExchange Interchange Code  7-bit code  8-bit code  contains 94 graphic  last 4 bits range from chars and 34 non- 0000-1001 printing chars
36. 36. Gray code• It is a binary number Binary Gray system where two Decimal code code successive values 0 000 000 differ in only one 1 001 001 2 010 011 digit, originally 3 011 010 designed to prevent 4 100 110 5 101 111 spurious output from 6 110 101 electromechanical 7 111 100 switches.
37. 37. Number Representations• No representation • Various methodsmethod is capable of can be used:representing all real – Fixed-point number systemnumbers – Rational number• Most real values systemmust be represented – Floating pointby an approximation number system – Logarithmic number system
38. 38. Fixed-point representation• It is a method used to represent integer values.• Disadvantages – Very small real numbers are not clearly distinguished – Very large real numbers are not known accurately enough
39. 39. Floating-point Representation• It is a method used to represent real numbers• Notation: – Mantissa x Baseexponent• Example 1 1000011 000100101100000000000000 = - 300.0
40. 40. Activity
41. 41. Activity01110111 01100101 01101100 01100011 01101111 01101101 01100101
42. 42. Activity 97 = ‘a’01110111 01100101 01101100 01100011 01101111 01101101 01100101