High Performance Computing Lecture 2: Data Representation in Computing, Slides of Computer Science

An overview of how data is represented in computing systems, focusing on character data using ascii code and signed integer data using both sign-magnitude and 2s complement representations. Additionally, it covers real data representation using the ieee floating point standard.

Typology: Slides

2012/2013

Uploaded on 04/28/2013

dewaan
dewaan 🇮🇳

3.8

(4)

43 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
High Performance Computing
Lecture 2
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download High Performance Computing Lecture 2: Data Representation in Computing and more Slides Computer Science in PDF only on Docsity!

High Performance Computing

Lecture 2

2 How is Data Represented?

 Character data: ASCII code

 Integer data

4

Representing Signed Integer Data

 Sign-magnitude representation

xn 1 xn 2 x 2 x 1 xo

  represents the value

 

 2 0

1 n i i

x i

xn

least significant bit (lsb) Example: In 8 bits 13 is represented as 00001101

  • 13 is represented as 10001101 Sign bit

5 Alternative: 2s Complement Representation x (^) n 1 xn 2 x 0 ...   The n bit quantity represents the signed integer value     

2 0 1 1 2 2 n i i i n x n x least significant bit Example: In 8 bits 13 is represented as 00001101

  • 13 is represented as 11110011
    • 128 + 64 + 32 + 16 + 2 + 1

7 Which Representation is Better?

 Considerations

 Speed of arithmetic (addition, multiplication)  Speed of comparison  Range of values that can be represented

 The 2s complement representation is widely

used

8 How is Data Represented?

 Character data: ASCII code

 Signed Integer data: 2s complement

 Real data

10 Real Data: Floating Point Representation

IEEE Floating Point Standard (IEEE 754)

32 bit value with 3 components ( s, e , f )

1. s (1 bit sign) 2. e (8 bit exponent) 3. f (23 bit fraction)

represents the value

127 ( 1 ) 1. 2     s e f

11

Consider the decimal value 0.

 Equal to 0.1 in binary

 s: 0, e: 126, f: 000…

 In 32 bits,

1

  1. 0 2   127 ( 1 ) 1. 2     s e f Example: IEEE Single Float

13 More on IEEE Floating Point

 Why is the exponent represented in this way?

(excess-127 representation for signed

integers)

 Normalized representation

 Special forms

 Denormalized values (exp = 0; f = non-zero)  Zero (exp = 0; f = 0)  Infinity (exp = 255; f = 0)  NaN (exp = 255; f = non-zero)

14 How is Data Represented?

 Character data: ASCII code

 Signed Integer data: 2s complement

 Real data: IEEE floating point