SlideShare a Scribd company logo
FLOATING POINT ARITHMETIC
Floating point arithmetic
• There are different representations for the
same number and there is no fixed position
for the decimal point.
• Given a fixed number of digits, there may be
a loss of precession.
• Three pieces of information represents a
number: sign of the number, the significant
value and the signed exponent of 10.
Note
Given a fixed number of digits, the
floating-point representation covers a wider
range of values compared to a fixed-point
representation.
Floating point arithmetic
Floating point arithmetic
Floating point arithmetic
Floating point arithmetic
Floating point arithmetic
Floating point arithmetic
BINARY REPRESENTATION OF
FLOATING POINT NUMBERS
Converting decimal fractions into binary
representation.
Consider a decimal fraction of the form: 0.d1d2...dn
We want to convert this to a binary fraction of the
form:
0.b1b2...bn (using binary digits instead of decimal
digits)
Algorithm for conversion
Let X be a decimal fraction: 0.d1d2..dn
i = 1
Repeat until X = 0 or i = required no.
of binary fractional digits {
Y = X * 2
X = fractional part of Y
Bi = integer part of Y
i = i + 1
}
EXAMPLE 1
Convert 0.75 to binary
X = 0.75 (initial value)
X* 2 = 1.50. Set b1 = 1, X = 0.5
X* 2 = 1.0. Set b2 = 1, X = 0.0
The binary representation for 0.75 is thus
0.b1b2 = 0.11b
Let's consider what that means...
In the binary representation
0.b1b2...bm
b1 represents 2-1 (i.e., 1/2)
b2 represents 2-2 (i.e., 1/4)
...
bm represents 2-m (1/(2m))
So, 0.11 binary represents
2-1 + 2-2 = 1/2 + 1/4 = 3/4 = 0.75
EXAMPLE 2
Convert the decimal value 4.9 into
binary
Part 1: convert the integer part into
binary: 4 = 100b
Part 2.
Convert the fractional part into binary
using multiplication by 2:
X = .9*2 = 1.8. Set b1 = 1, X = 0.8
X*2 = 1.6. Set b2 = 1, X = 0.6
X*2 = 1.2. Set b3 = 1, X = 0.2
X*2 = 0.4. Set b4 = 0, X = 0.4
X*2 = 0.8. Set b5 = 0, X = 0.8,
which repeats from the second line
above.
Since X is now repeating the value 0.8,
we know the representation will
repeat.
The binary representation of 4.9 is
thus:
100.1110011001100...
COMPUTER REPRESENTATION OF
FLOATING POINT NUMBERS
In the CPU, a 32-bit floating point
number is represented using IEEE
standard format as follows:
S | EXPONENT | MANTISSA
where S is one bit, the EXPONENT is 8
bits, and the MANTISSA is 23 bits.
•The mantissa represents the leading
significant bits in the number.
•The exponent is used to adjust the
position of the binary point (as opposed
to a "decimal" point)
The mantissa is said to be normalized
when it is expressed as a value between
1 and 2. I.e., the mantissa would be in
the form 1.xxxx.
The leading integer of the binary
representation is not stored. Since it
is always a 1, it can be easily
restored.
The "S" bit is used as a sign bit and
indicates whether the value represented
is positive or negative
(0 for positive, 1 for negative).
If a number is smaller than 1,
normalizing the mantissa will produce a
negative exponent.
But 127 is added to all exponents in the
floating point representation, allowing
all exponents to be represented by a
positive number.
Example 1. Represent the decimal value 2.5 in 32-bit
floating point format.
2.5 = 10.1b
In normalized form, this is: 1.01 * 21
The mantissa: M = 01000000000000000000000
(23 bits without the leading 1)
The exponent: E = 1 + 127 = 128 = 10000000b
The sign: S = 0 (the value stored is positive)
So, 2.5 = 01000000001000000000000000000000
Example 2: Represent the number -0.00010011b in
floating point form.
0.00010011b = 1.0011 * 2-4
Mantissa: M = 00110000000000000000000 (23 bits
with the integral 1 not represented)
Exponent: E = -4 + 127 = 01111011b
S = 1 (as the number is negative)
Result: 1 01111011 00110000000000000000000
Exercise 1: represent -0.75 in floating
point format.
Exercise 2: represent 4.9 in floating
point format.

More Related Content

PPTX
Quick tutorial on IEEE 754 FLOATING POINT representation
PPSX
Fixed point and floating-point numbers
PPT
DATA REPRESENTATION
PPTX
06 floating point
PDF
Floating point presentation
PPTX
Floating point arithmetic operations (1)
PPTX
Chapter 1 digital design.pptx
PPTX
IEEE floating point representation
Quick tutorial on IEEE 754 FLOATING POINT representation
Fixed point and floating-point numbers
DATA REPRESENTATION
06 floating point
Floating point presentation
Floating point arithmetic operations (1)
Chapter 1 digital design.pptx
IEEE floating point representation

What's hot (20)

PDF
Binaty Arithmetic and Binary coding schemes
PPTX
Floating point representation
PPT
Binary Arithmetic
PPTX
PPTX
Time space trade off
PPTX
Computer architecture data representation
PPTX
Multiplexer and DeMultiplexer
PPTX
3.codes( binary code ,excess 3, gray code )
DOCX
Control Units : Microprogrammed and Hardwired:control unit
PPTX
3. Addressing Modes in 8085 microprocessor.pptx
PPT
BCD,GRAY and EXCESS 3 codes
PPTX
Register transfer and micro-operation
PPTX
Modified booths algorithm part 1
PPTX
Number system conversion
PPT
Complements
PPTX
Computer arithmetic
PPTX
Memory interfacing
PDF
Binary Arithmetic Operations
PPTX
Parity Generator and Parity Checker
PPTX
Weighted and Non Weighted Codes
Binaty Arithmetic and Binary coding schemes
Floating point representation
Binary Arithmetic
Time space trade off
Computer architecture data representation
Multiplexer and DeMultiplexer
3.codes( binary code ,excess 3, gray code )
Control Units : Microprogrammed and Hardwired:control unit
3. Addressing Modes in 8085 microprocessor.pptx
BCD,GRAY and EXCESS 3 codes
Register transfer and micro-operation
Modified booths algorithm part 1
Number system conversion
Complements
Computer arithmetic
Memory interfacing
Binary Arithmetic Operations
Parity Generator and Parity Checker
Weighted and Non Weighted Codes
Ad

Similar to Floating point arithmetic (20)

PPTX
Implementation of character translation integer and floating point values
PDF
FIXED and FLOATING-POINT-REPRESENTATION.pdf
PDF
LEC-3-CAO-FLOATING-POINT-REPRESENTATION.pdf
PDF
Ieee+floating
PPTX
Floating Point Representation premium.pptx
PPTX
Computer Representation of Numbers and.pptx
DOCX
Floting point representation
PPTX
Floating point representation and arithmetic
PDF
IEEE 754 Standards For Floating Point Representation.pdf
PPTX
Floating-Point Representation (Computer Arithmetics).pptx
PPTX
Only floating point lecture 7 (1)
PPTX
Data Representation from knowledge center
PPT
Single Precision Floating Point Format.ppt
PPTX
Representation of numbers.pptx
PPT
Data representation
PDF
MCS222-DDCA-Lec.7-111111111111111111.pdf
PPTX
computer arithmetic’s (fixed and floating point)
PPTX
Floating Point Represenataion.pptx
PPTX
Floating point Binary Represenataion
PPTX
Aviraj --floating point representation and arithmetic.pptx
Implementation of character translation integer and floating point values
FIXED and FLOATING-POINT-REPRESENTATION.pdf
LEC-3-CAO-FLOATING-POINT-REPRESENTATION.pdf
Ieee+floating
Floating Point Representation premium.pptx
Computer Representation of Numbers and.pptx
Floting point representation
Floating point representation and arithmetic
IEEE 754 Standards For Floating Point Representation.pdf
Floating-Point Representation (Computer Arithmetics).pptx
Only floating point lecture 7 (1)
Data Representation from knowledge center
Single Precision Floating Point Format.ppt
Representation of numbers.pptx
Data representation
MCS222-DDCA-Lec.7-111111111111111111.pdf
computer arithmetic’s (fixed and floating point)
Floating Point Represenataion.pptx
Floating point Binary Represenataion
Aviraj --floating point representation and arithmetic.pptx
Ad

More from vishal choudhary (20)

PPTX
mobile application using automatin using node ja java on
PPTX
mobile development using node js and java
PPTX
Pixel to Percentage conversion Convert left and right padding of a div to per...
PPTX
esponsive web design means that your website (
PPTX
function in php using like three type of function
PPTX
data base connectivity in php using msql database
PPTX
software evelopment life cycle model and example of water fall model
PPTX
software Engineering lecture on development life cycle
PPTX
strings in php how to use different data types in string
PPTX
OPEN SOURCE WEB APPLICATION DEVELOPMENT question
PPTX
web performnace optimization using css minification
PPTX
web performance optimization using style
PPTX
Data types and variables in php for writing and databse
PPTX
Data types and variables in php for writing
PPTX
Data types and variables in php for writing
PPTX
sofwtare standard for test plan it execution
PPTX
Software test policy and test plan in development
PPTX
function in php like control loop and its uses
PPTX
introduction to php and its uses in daily
PPTX
data type in php and its introduction to use
mobile application using automatin using node ja java on
mobile development using node js and java
Pixel to Percentage conversion Convert left and right padding of a div to per...
esponsive web design means that your website (
function in php using like three type of function
data base connectivity in php using msql database
software evelopment life cycle model and example of water fall model
software Engineering lecture on development life cycle
strings in php how to use different data types in string
OPEN SOURCE WEB APPLICATION DEVELOPMENT question
web performnace optimization using css minification
web performance optimization using style
Data types and variables in php for writing and databse
Data types and variables in php for writing
Data types and variables in php for writing
sofwtare standard for test plan it execution
Software test policy and test plan in development
function in php like control loop and its uses
introduction to php and its uses in daily
data type in php and its introduction to use

Recently uploaded (20)

PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Insiders guide to clinical Medicine.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Cell Types and Its function , kingdom of life
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Institutional Correction lecture only . . .
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Lesson notes of climatology university.
PDF
VCE English Exam - Section C Student Revision Booklet
Anesthesia in Laparoscopic Surgery in India
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Supply Chain Operations Speaking Notes -ICLT Program
STATICS OF THE RIGID BODIES Hibbelers.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
human mycosis Human fungal infections are called human mycosis..pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Insiders guide to clinical Medicine.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Cell Types and Its function , kingdom of life
102 student loan defaulters named and shamed – Is someone you know on the list?
Institutional Correction lecture only . . .
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Complications of Minimal Access Surgery at WLH
GDM (1) (1).pptx small presentation for students
Pharma ospi slides which help in ospi learning
Lesson notes of climatology university.
VCE English Exam - Section C Student Revision Booklet

Floating point arithmetic

  • 3. • There are different representations for the same number and there is no fixed position for the decimal point. • Given a fixed number of digits, there may be a loss of precession. • Three pieces of information represents a number: sign of the number, the significant value and the signed exponent of 10.
  • 4. Note Given a fixed number of digits, the floating-point representation covers a wider range of values compared to a fixed-point representation.
  • 11. BINARY REPRESENTATION OF FLOATING POINT NUMBERS Converting decimal fractions into binary representation. Consider a decimal fraction of the form: 0.d1d2...dn We want to convert this to a binary fraction of the form: 0.b1b2...bn (using binary digits instead of decimal digits)
  • 12. Algorithm for conversion Let X be a decimal fraction: 0.d1d2..dn i = 1 Repeat until X = 0 or i = required no. of binary fractional digits { Y = X * 2 X = fractional part of Y Bi = integer part of Y i = i + 1 }
  • 13. EXAMPLE 1 Convert 0.75 to binary X = 0.75 (initial value) X* 2 = 1.50. Set b1 = 1, X = 0.5 X* 2 = 1.0. Set b2 = 1, X = 0.0 The binary representation for 0.75 is thus 0.b1b2 = 0.11b
  • 14. Let's consider what that means... In the binary representation 0.b1b2...bm b1 represents 2-1 (i.e., 1/2) b2 represents 2-2 (i.e., 1/4) ... bm represents 2-m (1/(2m)) So, 0.11 binary represents 2-1 + 2-2 = 1/2 + 1/4 = 3/4 = 0.75
  • 15. EXAMPLE 2 Convert the decimal value 4.9 into binary Part 1: convert the integer part into binary: 4 = 100b
  • 16. Part 2. Convert the fractional part into binary using multiplication by 2: X = .9*2 = 1.8. Set b1 = 1, X = 0.8 X*2 = 1.6. Set b2 = 1, X = 0.6 X*2 = 1.2. Set b3 = 1, X = 0.2 X*2 = 0.4. Set b4 = 0, X = 0.4 X*2 = 0.8. Set b5 = 0, X = 0.8, which repeats from the second line above.
  • 17. Since X is now repeating the value 0.8, we know the representation will repeat. The binary representation of 4.9 is thus: 100.1110011001100...
  • 18. COMPUTER REPRESENTATION OF FLOATING POINT NUMBERS In the CPU, a 32-bit floating point number is represented using IEEE standard format as follows: S | EXPONENT | MANTISSA where S is one bit, the EXPONENT is 8 bits, and the MANTISSA is 23 bits.
  • 19. •The mantissa represents the leading significant bits in the number. •The exponent is used to adjust the position of the binary point (as opposed to a "decimal" point)
  • 20. The mantissa is said to be normalized when it is expressed as a value between 1 and 2. I.e., the mantissa would be in the form 1.xxxx.
  • 21. The leading integer of the binary representation is not stored. Since it is always a 1, it can be easily restored.
  • 22. The "S" bit is used as a sign bit and indicates whether the value represented is positive or negative (0 for positive, 1 for negative).
  • 23. If a number is smaller than 1, normalizing the mantissa will produce a negative exponent. But 127 is added to all exponents in the floating point representation, allowing all exponents to be represented by a positive number.
  • 24. Example 1. Represent the decimal value 2.5 in 32-bit floating point format. 2.5 = 10.1b In normalized form, this is: 1.01 * 21 The mantissa: M = 01000000000000000000000 (23 bits without the leading 1) The exponent: E = 1 + 127 = 128 = 10000000b The sign: S = 0 (the value stored is positive) So, 2.5 = 01000000001000000000000000000000
  • 25. Example 2: Represent the number -0.00010011b in floating point form. 0.00010011b = 1.0011 * 2-4 Mantissa: M = 00110000000000000000000 (23 bits with the integral 1 not represented) Exponent: E = -4 + 127 = 01111011b S = 1 (as the number is negative) Result: 1 01111011 00110000000000000000000
  • 26. Exercise 1: represent -0.75 in floating point format. Exercise 2: represent 4.9 in floating point format.