Lecture 2

# Lecture 2 - CNIT 17600 Lecture 2 Data Representation...

This preview shows pages 1–11. Sign up to view the full content.

1/26/2012 1 Data Representation CNIT 17600 – Lecture 2 Objectives Describe numbering systems and their Understand the fundamentals of numerical data representation and manipulation in digital computers Master the skill of converting between various number systems Gain experience in the foundations of binary mathematical operations Understand how computation errors occur Gain familiarity with the most popular character codes 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1/26/2012 2 Bits & Bytes A bit is the most basic unit of information in a computer It is a state of “on” or “off” in a digital circuit Sometimes these states are “high” or “low” voltage instead of “on” or “off. .” A byte is a group of eight bits A byte is the smallest possible addressable unit of computer storage The term, “addressable,” means that a particular byte can be retrieved according to its location in memory 3 Bits & Bytes A word is a contiguous group of bytes Words can be any number of bits or bytes Word sizes of 16, 32, or 64 bits are most common In a word-addressable system, a word is the smallest addressable unit of storage A group of four bits is called a nibble Bytes consist of two nibbles: a “high-order nibble,” and a “low-order” nibble 4
1/26/2012 3 What is a Number? What does 123 mean? Number Systems Numeric values are all referenced to a base The base is the value that 10 represents When the base of a number is something other than 10, it is denoted by a subscript Sometimes, the subscript 10 is added for emphasis: 11001 2 = 25 10

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1/26/2012 4 Decimal “Normal” numbers Base 10 Valid digits are 0-9 Typically represented as: 123 123 10 123d Decimal The decimal number 123 in powers of 10 is: 1 × 10 2 + 2 × 10 1 + 3 × 10 0 = 1 x 100 + 2 x 10 + 3 x 1 = 123 10 The decimal number 6.47 in powers of 10 is: 6 × 10 0 + 4 × 10 -1 + 7 × 10 -2 = 6 x 1 + 4 x 0.1 + 7 x 0.01 = 6.47 10 8
1/26/2012 5 Hexadecimal Base 16 Valid digits are 0–9,A–F A to F are single digit representations of decimal 10-15 Each digit is represented by a 4 -bit nibble Typically represented as: 2CF 16 0x2CF 2CFh Hexadecimal Convert Hex C5F to Decimal:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1/26/2012 6 Hexadecimal Convert Hex C5F to Decimal: The hexadecimal number C5F in powers of 16: C x 16 3 + 5 x 16 2 + F x 16 0 = 12 x 256 + 5 x 16 + 15 x 1 = 3162 10 11 Hexadecimal Convert Decimal 634 to Hex:
1/26/2012 7 Hexadecimal 13 Convert Decimal 634 to Hex: 16 4 16 3 16 2 16 1 16 0 65536 4096 256 16 1 0 0 2 7 A 0 + 0 + 512 + 112 + 10 = 634 Binary Base 2 Valid digits are 0 & 1 Typically represented as: 1012 2 1012b

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1/26/2012 8 Binary Convert 11001b to decimal: Binary Convert 11001b to decimal: 1 x 2 4 + 1 x 2 3 + 0 x 2 2 + 0 x 2 1 + 1 x 2 0 = 1 x 16 + 1 x 8 + 0 x 4 + 0 x 2 + 1 x 1 = 25 10 16
1/26/2012 9 Binary Convert decimal 435 to binary: Binary Convert decimal 435 to binary: 2 10 2 9 2 8 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 1024 512 256 128 64 32 16 8 4 2 1 0 0 1 1 0 1 1 0 0 1 1 Reality Check :256+128+32+16+2+1=435 18

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1/26/2012 10 Data Representation Computers store everything as 1 ’s and 0 ’s All data must be converted to binary upon entering a computer Easy for integer numbers Just convert them to binary Be careful about number size Harder for decimals You must fit both the whole number and decimal into a fixed space Not as easy for characters
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 36

Lecture 2 - CNIT 17600 Lecture 2 Data Representation...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online