0% found this document useful (0 votes)
19 views12 pages

Floating Point Representation

Uploaded by

shahzadawaqas1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views12 pages

Floating Point Representation

Uploaded by

shahzadawaqas1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Chap.

16: Data Representation


1. Floating Point Representation (Real Numbers)
2. File Organization
3. User-defined data type (Abstraction)

HW

 Convert Dec 121 to FP Bin (10+6)


 Convert Bin 10111010 FP Bin (10+6)
Recap Ch.1
1. Concept of binary And decimal numbers (Fixed point)
2. Number System Conversions

Real Numbers

21. 564.

Left

2.1 x 101

.21 x 102

.021 x 103

Right

21.

210.0 x 10-1

2100 x 10-2

2345

.2345 x 104

Fixed Point Binary (1101) = ? Floating Point Binary

1101.

11.01 x 210

.1101 x 2100

Mantissa – Exponent

24 = ? FP Binary

11000.
.11000

Mantissa

0 1 1 0 0 0 0 0

Exponent

0 0 0 0 0 1 0 1

5–5=0
Day – 2
 Positive Binary to FP Binary
 Negative Binary to FP Binary
 Positive Decimal to FP Binary
 Negative Decimal to FP Binary
 Positive FP Binary to Decimal
 Negative FP Binary to Decimal

 Accuracy and Range


 Normalisation

Positive binary to FP Binary (8-BITs)

1011

.1011

0.1011000 00000100

Negative binary to FP Binary (8-BITs) (Two’s Complement)

100101

1.1001010 00000110

1099

10999

99

999

.324589

.3246

.32458900
Positive Decimal to FP Binary (8+ 8)

74 = FP Bin? (8+8)

128 64 32 16 8 4 2 1
0 1 0 0 1 0 1 0

1001010 Fixed Point

0.1001010 00000111

31.25

11111

.25 x 2 = .5 = 0

.5 x 2 = 1 = 1

.01

0.1111101 00000101

31.75

11111.11

.75 x 2 = 1.5 = 1 Exceeds 1 so 1 is the answer

.5 x 2 = 1 Remainder is multiplied by 2 again

31.33 (8:8)

11111.0

.33 x 2 = .66 = 0

.66 x 2 = 1.3 = 1
.3 x 2 = .6 = 0

.6 x 2 = 1.2 = 1

.2 x 2 = .4 = 0

11111.010

0.1111101 00000101

Positive FP binary to Decimal (8+ 8)

0.1111101 00000101 +5 -5 = 0

011111.01 00000000

32 16 8 4 2 1 ½ ¼
0 1 1 1 1 1 0 1

31 + .25

31.25

Negative Decimal to FP Binary (8+ 8)

-31.25

+31.25

0.1111101 00000101

10000010 (1’s Compl) Invert all the BITs

10000011 (2’s Compl) (Add 1 to 1’s Compl)

1.0000011 00000101

Negative FP binary to Decimal (8+ 8)

1.0000011 00000101

100000.11 00000000
-32 16 8 4 2 1 ½ ¼
1 0 0 0 0 0 1 1

-32 + .75

-31.25
Day – 3

Accuracy = Mantissa

Range = Exponent

23.456 23

10999

Normalisation

0.0010111 00000100

000.10111 4-2 = 2

0.1011100 00000010

10010110

-128+16+4+2

-106-2 = -108

-30 11111111

1.1110101

1.0101000 00000010

0.1011000 2-3 = -1

0.1011000 00000001 Rep +1

11111110 BITs inverted

0.1011000 11111111 1 BIT added

32.45 x 103

324.5 x 102
.3245 x 105

Day – 4
Past Papers
0.1101000 0100

01101.000 0000

+13

+001 10-99

0111

0.1000000

1000 (2-8)

1111 (-8+4+2+1)

.00000001 0000

1/512

Smallest positive number (8+8)

0.0000001 (1/128) 00000000

10000000

23 x 100

23 x 10-9

Largest Positive Number

0.1111111 01111111

Smallest Negative Number

1.0111111 10000000 (Normalised Mantissa)

1.1111111 (Un Normalised)


10100011

Day – 5
Past Papers
3.5

11.1

0.1110000 0010

0.1110000 0010

10001111+1

10010000 0010

-000 x 109999

21.75

10101.11

.1010111

10110000 1110

01001111 + 1

0.1010000 1110 = -8 + 4 + 2 = -2

0.0010100 0000

1/8 + 1/32 =

- 5/32
File Organisation

Text File + Binary file

(Create + Access)

1. Serial
2. Sequential
3. Random (Direct)

Serial(Serial)

Data is put in the order it is created.

 Easier to setup
 Easy to update
 Difficult and slower to access the record

e.g. bank transaction

Sequential(Sequential, Serial)

Data is in order

 Difficult to setup
 Difficult to update
 Easier and faster to access the record

(Data is compared with the search string one after the other)

e.g. Movie show timings, Language dictionery

Random File (Direct access)

Data is accessed directly, data isn’t in any order using hashing algorithm

(Search is carried out address to address directly)

 Difficult to setup
 Moderately Difficult to update
 Fastest access of data
Ali 1+12+9 = 22 (Record key/address)

Zain 26+1+9+14 = 50

Zain 50

Open Hashing (in case of clash, next available location is used)

Close Hashing (in case of clash, different hashing algorithm is used)

Access

Ali = Hashing Algorithm = 22

e.g ATM transactions, phone queries

-9/16 to normalized FP Binary??

16 8 4 2 1 ½ ¼ 1/8
0 0 0 0 0 1 0 1

½ + 1/8

4+1 = 5/8

½ ¼ 1/8 1/16

8 +4+ 2 +1

16

0.1001000 00000000

10110111

10111000 00000000

You might also like