0% found this document useful (0 votes)
11 views9 pages

Data Representation Using Floating Point and IEEE Conventions

This document discusses floating point number representation and character representation in computers. It explains: 1) Floating point numbers use scientific notation with a sign, mantissa, and exponent. In computers, they use binary floating point representation specified by IEEE with 32 or 64 bits. 2) It provides an example of representing -53/8 in 32-bit floating point format. 3) Character representation in computers uses the ASCII standard where each character is represented by an 8-bit code.

Uploaded by

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

Data Representation Using Floating Point and IEEE Conventions

This document discusses floating point number representation and character representation in computers. It explains: 1) Floating point numbers use scientific notation with a sign, mantissa, and exponent. In computers, they use binary floating point representation specified by IEEE with 32 or 64 bits. 2) It provides an example of representing -53/8 in 32-bit floating point format. 3) Character representation in computers uses the ASCII standard where each character is represented by an 8-bit code.

Uploaded by

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

Computer

Programming
CS F111
BITS Pilani
Dubai Campus
BITS Pilani
Dubai Campus

Data Representation- Floating Point


Floating Point Nos
• Scientific notation: +6.023 x 10+23
• Sign, Mantissa (normalized), Exponent
• Computer: binary Floating point (IEEE Floating point rep)
•Single precision = 32 bits (shown in figure: 1 sign bit., 8 exponent, 23 mantissa)
•Double Precision = 64 bits (1 sign bit, 10 exponent, 53 mantissa)

S: sign bit (0  non-negative, 1  negative)


Normalize significand: 1.0 ≤ |significand| < 2.0
– Always has a leading pre-binary-point 1 bit, so no need to represent it
explicitly (hidden bit)
– Significand is Fraction with the “1.” restored when performing calculation
Exponent: excess representation: actual exponent + Bias
– Ensures exponent is unsigned
– Single: Bias = 127; Double: Bias = 1203

BITS Pilani, Dubai Campus


Floating Point Nos
• Eg: represent -53/8 (-6.625) in IEEE Floating point (32 bits)

•Step 1: Express in binary -110.101

• Step 2: Normalize -1.10101 x 22 (Value should be same)

• Step 3: Get the biased exponent = actual exponent + bias


2 + 127 = 129 (Stored Exp)

• Step 4: Represent 129 in binary 10000001

•Step 5: s=1(-ve no), exponent=10000001


mantissa = 101010000 (23 bits). Note: Leading 1 is not stored

1 10000001 1010 1000 0000 0000 000


BITS Pilani, Dubai Campus
Floating Point Nos
• For mantissa, leading 1 is implied
• Its normalized in the form 1.bbbbb…
• Shift the point and adjust exponent so that value is not changed
• Biased exponent is used for simple exponent manipulations
• Eg: Represent in decimal

-ve No Stored Exp = Mantissa = 1.10101


Actual Exp – 127 = = 1.6563

Actual Exp = 123 – 127


= -4
Final Value = 1.6563 x 2-4= -0.10351875

• Exponent range = -126 to 254 (0 & 255 have special meaning)

BITS Pilani, Dubai Campus


Floating Point Eg.
a) Represent –0.75
– –0.75 = (–1)1 × 0.112 × 20 = (–1)1 × 1.12 × 2–1
– S=1
– Fraction = 1000…002
– Exponent = –1 + Bias
• Single: Exponent = –1 + 127 = 126 = 011111102
1 01111110 1000…00
• Double: Exponent = –1 + 1023 = 1022 = 011111111102
1 01111111110 1000…00

b) -150.75 Repr in IEEE FP (32 bits)


150.75 = (10010110.11)2
= 1.001011011 × 27
Biased Exponent E = Actual Exponent + bias = 7 + 127 = 134 = (1000 0110)2
Sign Exponent Mantissa/Fraction
1 1000 0110 00101101100..

BITS Pilani, Dubai Campus


Floating Point Eg.
What number is represented by the single-
precision float
1 10000001 01000…00
– S=1
– Fraction = 01000…002
– Exponent = 100000012 = 129

x = (–1)1 × (1 + .012) × 2(129 – 127)


= (–1) × 1.25 × 22
= –5.0

BITS Pilani, Dubai Campus


Character Representation
• Representation.eg ‘A’ = ? , ‘0’ = ? , ‘%’ = ?

• ASCII standard is used.


‘ ‘ = 32, ‘A’ = 65, ‘B’ =66, ‘a’ = 97, ‘0’ = 48
• 8 bits are used to represent a character.
• Zero-extended when stored in 16/32 bit words
• ASCII value of character ‘1’
= ASCII value of ‘0’ + 1 = 48 + 1 = 49
• ASCII values of upper case ‘A, ‘B’, ‘C’ & lower case ‘a’, ‘b’, ‘c’

BITS Pilani, Dubai Campus


Character Representation

BITS Pilani, Dubai Campus

You might also like