F L O A T IN G P O IN T N U M B E R S E n g la n d er C h . 5 ITEC 1011Introduction to Information Technologies
E x p o n en ti al N o ta ti o n
The representations differ in that the decimal place – the “point”--“floats”to the left or right (with the appropriate adjustment in the exponent).• T h e fo ll o w in g a re e q u iv al en t re p re se n ta ti o n s o f 1 ,2 3 4
123,400.0x10-2 12,340.0x10-1 1,234.0x100 123.4x101 12.34x102 1.234x103 0.1234x104 ITEC 1011Introduction to Information TechnologiesP ar ts o f a F lo at in g P o in t N u m b er - 0 . 9 8 7 6 x 1 0
-3 Sign of mantissaLocation of decimal pointMantissaExponent Sign of exponent Base
E x p o n en t E x ce ss 5 0 R ep re se n ta ti o n
•W it h 2 d ig it s fo r th e ex p o n en t an d 5 f o r th e m a n ti ss a: f ro m . 0 0 0 0 1 x 1 0
-50to . 9 9 9 9 9 x 1 0
49O v er fl o w s / U n d er fl o w s
•F ro m .0 0 0 0 1 x 1 0
-50to . 9 9 9 9 9 x 1 0
491 x 1 0
-55to . 9 9 9 9 9 x 1 0
49T y p ic al F lo at in g P o in t F o rm at
EC 1011Introduction to Information TechnologiesIE E E 7 5 4 S ta n d ar d
•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) ITEC 1011Introduction to Information TechnologiesS in g le P re ci si o n F o rm at
32 bits Mantissa (23 bits) Exponent (8 bits) Sign of mantissa (1 bit)ITEC 1011Introduction to Information Technologies
D o u b le P re ci si o n F o rm at
64 bits Mantissa (52 bits) Exponent (11 bits) Sign of mantissa (1 bit) ITEC 1011Introduction to Information TechnologiesN o rm al iz at io n • T h e m an ti ss a is
normalized• H as a n i m p li ed d ec im a l p la ce o n l ef t • H as a n i m p li ed “ 1 ” o n l ef t o f th e d ec im al p la ce • E .g .,
•Mantissa: •Representation:1010000000000000000000 1.1012=1.62510 ITEC 1011Introduction to Information Technologies
E x ce ss N o ta ti o n
•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 nlarger than the actual exponent •E.g., –excess 127, •Exponent: •Representation:10000111 135–127=8(value) ITEC 1011Introduction to Information Technologies
E x ce ss N o ta ti o n
-Sample - Represent exponent of 1410in excess 127 form: 12710= + 011111112 1410= +000011102 Representation=100011012EC 1011Introduction to Information Technologies
E x ce ss N o ta ti o n
-Sample - Represent exponent of -810in excess 127 form: 12710= + 011111112 -810= -000010002 Representation=011101112 ITEC 1011Introduction to Information TechnologiesE x am p le • S in g le p re ci si o n
01000001011000000000000000000000 1.112= 1.7510 130 –127 = 3 0 = positive mantissa +1.75×23= 14.0 EC 1011Introduction to Information TechnologiesE x er ci se – F lo at in g P o in t C o n v er si o n ( 1 ) • W h at d ec im al v al u e is r ep re se n te d b y t h e fo ll o w in g 3 2 -b it f lo at in g p o in t n u m b er ? • A n sw er :
11000001011110110000000000000000 Skip answerAnswer ITEC 1011Introduction to Information Technologies
E x er ci se – F lo at in g P o in t C o n v er si o n ( 1 ) • W h at d ec im al v al u e is r ep re se n te d b y t h e fo ll o w in g 3 2 -b it f lo at in g p o in t n u m b er ? • A n sw er : -1 5 .6 8 7 5
11000001011110110000000000000000
Answer
ITEC 1011Introduction to Information Technologies
11000001011110110000000000000000 To decimal form 130 -127 = 31.11110110000000000000000000 1 + .5 + .25 + .125 + .0625 + 0 + .015625 + .0078125 1.960937523 *= 15.6875
- 1 5 .6 8 7 5
( negative )S te p b y S te p S o lu ti o n
ITEC 1011Introduction to Information Technologies11000001011110110000000000000000 To decimal form 130 -127 = 31.11110110000000000000000000 1111.10110000000000000000000
- 1 5 .6 8 7 5
( negative )Shift “Point”
Step by Step Solution : Alternative Method ITEC 1011Introduction to Information Technologies
E x er ci se – F lo at in g P o in t C o n v er si o n ( 2 ) • E x p re ss 3 .1 4 a s a 3 2 -b it f lo at in g p o in t n u m b er
•Answer: •(Note: only use 10 significant bits for the mantissa) Skip answerAnswerE x er ci se – F lo at in g P o in t C o n v er si o n ( 2 ) • E x p re ss 3 .1 4 a s a 3 2 -b it f lo at in g p o in t n u m b er
•Answer:Answer 01000000010010001111010111000010
3.14 To Binary:11. 0010001111010111000010 Delete implied left-most “1” and normalize10010001111010111000010 Exponent = 127 + 1 position point moved when normalized10000000 Value is positive: Sign bit = 0 0 1000000010010001111010111000010
Poof !
Detail Solution : 3.14 to IEEE Simple Precision
IE E E S in g le -P re ci si o n F lo at in g P o in t F o rm at
•E x p o n en t b ia s is 1 2 7 f o r n o rm al iz ed # s
e e Value Type 255 nonenoneInfinity or NaN 254 127 (-1)s××××(1.f1f2...)××××2127Normalized ... ... ... ... 2 -125 (-1)s××××(1.f1f2...)××××2-125Normalized 1 -126 (-1)s××××(1.f1f2...)××××2-126Normalized 0 -126 (-1)s××××(0.f1f2...)××××2-126Denormalized
^
sê
f 1 f 2
. . . f23
signexponentfraction 189310