0% found this document useful (0 votes)
48 views

Floating Point Representation: Major: All Engineering Majors Authors: Autar Kaw, Matthew Emmons

This document discusses floating point representation in computers. It explains that floating point numbers are stored in binary format with three components - a sign bit, exponent field, and mantissa. It provides examples of how different numeric values are represented in this format. It also describes the IEEE 754 standard for single and double precision floating point numbers, which standardizes the representation and arithmetic operations for floating point values on different computer systems.

Uploaded by

Harris Anches
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Floating Point Representation: Major: All Engineering Majors Authors: Autar Kaw, Matthew Emmons

This document discusses floating point representation in computers. It explains that floating point numbers are stored in binary format with three components - a sign bit, exponent field, and mantissa. It provides examples of how different numeric values are represented in this format. It also describes the IEEE 754 standard for single and double precision floating point numbers, which standardizes the representation and arithmetic operations for floating point values on different computer systems.

Uploaded by

Harris Anches
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

6/12/2013 http://numericalmethods.eng.usf.

edu 1
Floating Point Representation
Major: All Engineering Majors

Authors: Autar Kaw, Matthew Emmons

http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates



Floating Point Representation



http://numericalmethods.eng.usf.edu



http://numericalmethods.eng.usf.edu 3
Floating Decimal Point : Scientific Form
2
3
2
10 .5678 2 as written is 78 . 256
10 678 . 3 as written is 003678 . 0
10 5678 . 2 as written is 78 . 256

+
+


http://numericalmethods.eng.usf.edu 4
Example
exponent
10 mantissa sign
The form is

or

Example: For



e
m 10 o
2
10 5678 . 2
2
5678 . 2
1
=
=
=
e
m
o

http://numericalmethods.eng.usf.edu 5
Floating Point Format for Binary
Numbers
( )
( ) ( ) | | m m
m y
e
2 2
10 1 mantissa
ve - for 1 ve, for 0 number of sign
2
< < =
+ =
=
o
o
1 is not stored as it is always given to be 1.
exponent integer = e

http://numericalmethods.eng.usf.edu 6
Example
( ) ( ) ( )
( ) ( )
2 2
5
2 2 10
101 1011 . 1
2 1011011 . 1 11 . 110110 75 . 54
~
= =
9 bit-hypothetical word
the first bit is used for the sign of the number,
the second bit for the sign of the exponent,
the next four bits for the mantissa, and
the next three bits for the exponent

We have the representation as
0 0 1 0 1 1 1 0 1
Sign of the
number
mantissa
Sign of the
exponent
exponent

http://numericalmethods.eng.usf.edu 7
Machine Epsilon
Defined as the measure of accuracy and found
by difference between 1 and the next number
that can be represented

http://numericalmethods.eng.usf.edu 8
Example
Ten bit word
Sign of number
Sign of exponent
Next four bits for exponent
Next four bits for mantissa
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1
4
2 1 0625 . 1

= = e
mach
Next
number
( )
10
1 =
( ) ( )
10 2
0625 . 1 0001 . 1 = =

http://numericalmethods.eng.usf.edu 9
Relative Error and Machine
Epsilon
The absolute relative true error in representing
a number will be less then the machine epsilon
Example
( ) ( )
( )
( )
2
0110
2
5
2 10
2 1100 . 1
2 1100 . 1 02832 . 0

=
~
10 bit word (sign, sign of exponent, 4 for exponent, 4 for mantissa)
0 1 0 1 1 0 1 1 0 0
( )
( )
0625 . 0 2 034472 . 0
02832 . 0
0274375 . 0 02832 . 0
0274375 . 0 2 1100 . 1
4
0110
2
2
= < =

= e
=

a
Sign of the
number
mantissa
Sign of the
exponent
exponent
IEEE 754 Standards for Single
Precision Representation




http://numericalmethods.eng.usf.edu
IEEE-754 Floating Point
Standard
Standardizes representation of
floating point numbers on
different computers in single and
double precision.

Standardizes representation of
floating point operations on
different computers.
One Great Reference
What every computer scientist (and even if
you are not) should know about floating point
arithmetic!

http://www.validlab.com/goldberg/paper.pdf
13
IEEE-754 Format Single
Precision
32 bits for single precision
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sign
(s)
Biased
Exponent (e)
Mantissa (m)
( )
127 '
2
2 1 ) 1 ( Value .

=
e s
m
14
Example#1
( ) ( )
127 '
2
2 . 1 1 Value

=
e
s
m
( ) ( )
127 ) 10100010 (
2
1
2
2 10100000 . 1 1

=
( ) ( )
127 162
2 625 . 1 1

=
( ) ( )
10 35
10 5834 . 5 2 625 . 1 1 = =
1 1 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sign
(s)
Biased
Exponent (e)
Mantissa (m)
15
Example#2
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Sign
(s)
Biased
Exponent (e)
Mantissa (m)
Represent -5.5834x10
10
as a single
precision floating point number.
( ) ( )
?
1
10
2 ? . 1 1 10 5834 . 5

=
16
Exponent for 32 Bit IEEE-754
8 bits would represent
255 0 s
'
s e
Bias is 127; so subtract 127 from
representation
128 127 s s e
Exponent for Special Cases
e
'
Actual range of
254 1 s
'
s e
0 =
'
e
and
255 =
'
e
are reserved for special numbers
Actual range of
127 126 s s e
e
Special Exponents and Numbers
0 =
'
e
all zeros
255 =
'
e
all ones
s m Represents
0 all zeros all zeros 0
1 all zeros all zeros -0
0 all ones all zeros
1 all ones all zeros
0 or 1 all ones non-zero NaN
e
'


19
IEEE-754 Format
The largest number by magnitude
The smallest number by magnitude
Machine epsilon
( )
38 127
2
10 40 . 3 2 1 ........ 1 . 1 =
( )
38 126
2
10 18 . 2 2 0 ...... 00 . 1

=
7 23
10 19 . 1 2

= =
mach
c
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice tests,
worksheets in MATLAB, MATHEMATICA, MathCad and
MAPLE, blogs, related physical problems, please visit

http://numericalmethods.eng.usf.edu/topics/floatingpoint_re
presentation.html

THE END



http://numericalmethods.eng.usf.edu

You might also like