Presentation is loading. Please wait.

Presentation is loading. Please wait.

Floating Point Representations

Similar presentations


Presentation on theme: "Floating Point Representations"— Presentation transcript:

1 Floating Point Representations
CDA 3101 Discussion Session 02

2 Question 1 Converting the binary number
to decimal, if the binary is single precision floating-point?

3 Question 1 Converting bin (Single precision FP) to decimal
Sign bit : 1 Exponent : = 129 Fraction : =1* *2-3 + … + 1* * *2-22 = (-1)S * (1.Fraction) * 2(Exponent - 127) =(-1)1 * ( ) * 2( ) = * 2( ) = S(1) Biased Exponent(8) Fraction (23)

4 Question 2 Show the IEEE 754 binary representation for the floating-point number in single­precision and double­precision

5 Question 2.1 Converting 0.110 to single-precision FP
Step1: Covert fraction 0.1 to binary (multiplying by 2) 0.1*2 = 0.2, 0.2*2 = 0.4, 0.4*2 = 0.8, 0.8*2 = 1.6, 0.6*2 = 1.2, 0.2*2 = 0.4, 0.4*2 = 0.8, 0.8*2 = 1.6, 0.6*2 = 1.2, … … … * 2-4 Step2: Express in single precision format (-1)S * (1.Fraction) * 2(Exponent +127) =(-1)0 * ( ) * 2(-4+127)

6 Question 2.2 Converting 0.110 to double-precision FP
Step1: Covert fraction 0.1 to binary (multiplying by 2) 0.1*2 = 0.2, 0.2*2 = 0.4, 0.4*2 = 0.8, 0.8*2 = 1.6, 0.6*2 = 1.2, 0.2*2 = 0.4, 0.4*2 = 0.8, 0.8*2 = 1.6, 0.6*2 = 1.2, … … … * 2-4 Step2: Express in double precision format (-1)S * (1.Fraction) * 2(Exponent +1023) =(-1)0 * ( ) * 2( )

7 Question 3 Convert the following single-precision numbers into decimal

8 Question 3.1 Converting bin (Single precision FP) to dec
Sign bit : 0 Exponent : = Infinity Fraction : = 0 Infinity S(1) Biased Exponent(8) Fraction (23)

9 Question 3.2 Converting bin (Single precision FP) to dec
Sign bit : 0 Exponent : = 0 Fraction : =1*2-22 = (-1)S * (0.Fraction) * 2-126 =(-1)0 * ( ) * 2-126 = * 10-45 S(1) Biased Exponent(8) Fraction (23)

10 Question 4 Consider the 80-bit extended-precision IEEE 754 floating point standard that uses 1 bit for the sign, 16 bits for the biased exponent and 63 bits for the fraction (f). Then, write (i) the 80- bit extended-precision floating point representation in binary and (ii) the corresponding value in base-10 positional (decimal) system of the third smallest positive normalized number the largest (farthest from zero) negative normalized number the third smallest positive denormalized number that can be represented.

11 Question 4.1 The third smallest positive normalized number
Bias: = 32767 Sign: 0 Biased Exponent: Fraction (f): 61 zeros followed by 10 Decimal Value: (-1)0*2( )*(1+2-62) =

12 Question 4.2 The largest (farthest from zero) negative normalized number Sign: 1 Biased Exponent: Fraction: 63 ones Decimal Value: (-1)1*2( )*( …+2-63) = (264-1)2-63 = (approx.)

13 Question 4.3 The third smallest positive denormalized number Sign: 0
Biased Exponent: Fraction: 61 zeros followed by 11 Decimal Value: (-1)0* *( ) = 3*


Download ppt "Floating Point Representations"

Similar presentations


Ads by Google