Floating Point Numbers - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

Floating Point Numbers

Description:

Sign of mantissa (1 bit) ITEC 1011. Introduction to Information Technologies ... The mantissa is normalized. Has an implied decimal place on left ... – PowerPoint PPT presentation

Number of Views:191
Avg rating:3.0/5.0
Slides: 30
Provided by: scottma9
Category:

less

Transcript and Presenter's Notes

Title: Floating Point Numbers


1
Floating Point Numbers
Chapter 5
2
Exponential Notation
  • The following are equivalent representations of
    1,234

123,400.0 x 10-2 12,340.0 x 10-1 1,234.0
x 100 123.4 x 101 12.34 x 102
1.234 x 103 0.1234 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
  • -0.9876 x 10-3

p. 123
4
Figure 5.1 Excess-50 representation
5
Figure 5.2 Regions of overflow and underflow
6
Figure 5.4 Typical floating point format
7
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
  • Sign bit (1 bit)
  • Exponent (11 bits)
  • Mantissa (52 bits)

8
Single Precision Format
32 bits
9
Double Precision Format
64 bits
kc
10
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

10100000000000000000000 1.1012 1.62510
11
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

10000111 135 127 8 (value)
Ed kc
12
Excess Notation- Sample -
Represent exponent of 1410 in excess 127 form
12710 011111112 1410
000011102 Representation 100011012
Ed kc
kc
13
Excess Notation- Sample -
Represent exponent of -810 in excess 127 form
12710 011111112 - 810 -
000010002 Representation
011101112
Ed kc
kc
14
Example
  • Single precision

0 10000010 11000000000000000000000
15
Exercise Floating Point Conversion (1)
  • What decimal value is represented by the
    following 32-bit floating point number?
  • Answer

1 10000010 11110110000000000000000
Skip answer
Answer
16
Exercise Floating Point Conversion (1)
Answer
  • What decimal value is represented by the
    following 32-bit floating point number?
  • Answer -15.6875

1 10000010 11110110000000000000000
17
Step by Step Solution
1 10000010 11110110000000000000000
To decimal form
130 - 127 3
1.11110110000000000000000000
1 .5 .25 .125 .0625 0 .015625
.0078125
1.9609375
23
15.6875

- 15.6875
( negative )
18
Step by Step Solution Alternative Method
1 10000010 11110110000000000000000
To decimal form
130 - 127 3
1.11110110000000000000000000
1111.10110000000000000000000
Shift Point
- 15.6875
( negative )
kc
19
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
20
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)

0 10000000 10010001111000000000000
21
Figure 5.6 IBM floating point formats
22
Figure 5.7 Alpha floating point formats
23
Detail Solution 3.14 to IEEE double precision
3.14 To Binary (approx)
11.001000111101
Delete implied left-most 1 and normalize
1001000111101
Poof !
Exponent 127 1 position point moved when
normalized
10000000
Value is positive Sign bit 0
0 10000000 10010001111010000000000
24
Packed Decimal Format - 1 of 4
Somewhat limited use e.g Where precision
particularly important, as in accounting
functions. Similar to BCD e.g Four bit
representation, as in BCD. -gt Stores two
digits per byte.
kc
25
Packed Decimal Format - 2 of 4
Stores up to 31 digits Last four bits
for sign - 1100 -gt positive - 1101 -gt
negative - 1111 -gt unsigned Decimal Point
not stored must be maintained by separate
(application) software.
kc
26
Packed Decimal Format - 3 of 4
Example Decimal Value 10357, unsigned Packed
Decimal 0001 0000 0011 0101 0111 1111
Byte 1 Byte 2 Byte 3
kc
27
Packed Decimal Format - 4 of 4
Example Decimal Value - 90413 Packed
Decimal 1001 0000 0100 0001 0011 1101
Byte 1 Byte 2 Byte 3
kc
28
Figure 5.8 Packed decimal format
29
Thank you
Thats all this time !!
Write a Comment
User Comments (0)
About PowerShow.com