Presentation is loading. Please wait.

Presentation is loading. Please wait.

Floating Point Numbers

Similar presentations


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

1 Floating Point Numbers
Chapter 5

2 Exponential Notation The following are equivalent representations of 1,234 123, x 10-2 12, x 10-1 1, x 100 x 101 x 102 x 103 x 104 The representations differ in that the decimal place – the “point” -- “floats” to the left or right (with the appropriate adjustment in the exponent). p. 122

3 Parts of a Floating Point Number
Sign of mantissa Location of decimal point Mantissa Exponent Sign of exponent Base x 10-3 p. 123

4 IEEE 754 Standard Most common standard for representing floating point numbers Single precision: 32 bits, consisting of... Sign bit (1 bit) Exponent (8 bits) Mantissa (23 bits) Double precision: 64 bits, consisting of… Exponent (11 bits) Mantissa (52 bits)

5 Single Precision Format
32 bits Mantissa (23 bits) Exponent (8 bits) Sign of mantissa (1 bit)

6 Double Precision Format
64 bits Mantissa (52 bits) Exponent (11 bits) Sign of mantissa (1 bit) kc

7 Normalization The mantissa is normalized
Has an implied decimal place on left Has an implied “1” on left of the decimal place E.g., Mantissa: Representation: =

8 Excess Notation To include both positive and negative exponents, “excess-n” notation is used Single precision: excess 127 Double precision: excess 1023 The value of the exponent stored is n larger than the actual exponent E.g., – excess 127, Exponent: Representation: 135 – 127 = 8 (value) Ed kc

9 Excess Notation - Sample -
Represent exponent of in excess 127 form: = = Representation = Ed kc kc

10 Excess Notation - Sample -
Represent exponent of in excess 127 form: = = Representation = Ed kc kc

11 Example Single precision +1.75  23 = 14.0
1.112 = 130 – 127 = 3 0 = positive mantissa +1.75  23 = 14.0

12 Exercise – Floating Point Conversion (1)
What decimal value is represented by the following 32-bit floating point number? Answer: Skip answer Answer

13 Exercise – Floating Point Conversion (1)
Answer What decimal value is represented by the following 32-bit floating point number? Answer:

14 Step by Step Solution To decimal form 23 1.9609375 = 15.6875
To decimal form = 3 23 = * ( negative )

15 Step by Step Solution : Alternative Method
To decimal form = 3 Shift “Point” ( negative ) kc

16 Exercise – Floating Point Conversion (2)
Express 3.14 as a 32-bit floating point number Answer: (Note: only use 10 significant bits for the mantissa) Skip answer Answer

17 Exercise – Floating Point Conversion (2)
Answer Express 3.14 as a 32-bit floating point number Answer: (Note: only use 10 significant bits for the mantissa)

18 Detail Solution : 3.14 to IEEE double precision
3.14 To Binary (approx): Delete implied left-most “1” and normalize Poof ! Exponent = position point moved when normalized Value is positive: Sign bit = 0

19 Packed Decimal Format - 1 of 4
* Somewhat limited use: eg: Where precision particularly important, as in accounting functions. * Similar to BCD: eg: Four bit representation, as in BCD. -> Stores two digits per byte. kc

20 Packed Decimal Format - 2 of 4
* Stores up to 31 digits * Last four bits for sign: > positive > negative > unsigned * Decimal Point not stored: must be maintained by separate (application) software. kc

21 Packed Decimal Format - 3 of 4
Example: Decimal Value: 10357, unsigned Packed Decimal: Byte Byte Byte 3 kc

22 Packed Decimal Format - 4 of 4
Example: Decimal Value: Packed Decimal: Byte Byte Byte 3 kc

23 That’s all this time !! Thank you


Download ppt "Floating Point Numbers"

Similar presentations


Ads by Google