Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1: Data Representation Dr Mohamed Menacer Taibah University 2007-2008.

Similar presentations


Presentation on theme: "Chapter 1: Data Representation Dr Mohamed Menacer Taibah University 2007-2008."— Presentation transcript:

1 Chapter 1: Data Representation Dr Mohamed Menacer Taibah University 2007-2008

2 Bits are just bits (0,1) conventions define relationship between bits and numbers conventions define relationship between bits and numbers Binary integers (base 2) 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001... 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001... decimal: 0, …, 2 n -1 decimal: 0, …, 2 n -1 Of course it gets more complicated: bit strings are finite, but bit strings are finite, but for some fractions and real numbers, finitely many bits is not enough, so overflow & approximation errors: e.g., represent 1/3 as binary! negative integers negative integers How do we represent negative integers? which bit patterns will represent which integers? which bit patterns will represent which integers? Numbers n bits

3 From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

4

5

6 IBM's 8-bit extension of the 4-bit Binary Coded Decimal encoding of digits 0-9 (0000-1001), for character encoding.

7 From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

8

9

10

11

12

13

14 Floating Point We need a way to represent numbers with fractions, e.g., 3.1416 numbers with fractions, e.g., 3.1416 very small numbers (in absolute value), e.g.,.00000000023 very small numbers (in absolute value), e.g.,.00000000023 very large numbers (in absolute value), e.g., –3.15576 * 10 46 very large numbers (in absolute value), e.g., –3.15576 * 10 46Representation: scientific: sign, exponent, significand form: scientific: sign, exponent, significand form: (–1) sign *  significand *  2 exponent. E.g., –101.001101 * 2 111001 more bits for significand gives more accuracy more bits for significand gives more accuracy more bits for exponent increases range more bits for exponent increases range binary point

15 From Essentials of Computer Architecture by Douglas E. Comer. ISBN 0131491792. © 2005 Pearson Education, Inc. All rights reserved.

16

17 Scales, Units, and Conventions Term K (kilo-) M (mega-) G (giga-) T (tera-) 10 3 6 9 12 2 10 = 1024 2 20 = 1,048,576 2 30 = 1,073,741,824 2 40 = 1,099,511,627,776 Normal UsageAs a power of 2 Term Usage m (milli-)  (micro-) n (nano-) p (pico-) 10 -3 10 -6 10 -9 10 -12 Units: Bit (b), Byte (B), Nibble, Word (w), Double Word, Long Word Second (s), Hertz (Hz) Powers of 2 are used to describe memory sizes. Note the differences between usages. You should commit the powers of 2 and 10 to memory.


Download ppt "Chapter 1: Data Representation Dr Mohamed Menacer Taibah University 2007-2008."

Similar presentations


Ads by Google