SlideShare a Scribd company logo
Real Numbers
What about the other numbers?
So far we know how to store integers
Whole Numbers
But what if we want to store real numbers
Numbers with decimal fractions
Even 27.5 needs another way to represent it.
This method is called floating point representation
Fixed Notation
We are accustomed to using a fixed notation where the decimal point is fixed and we
know that any numbers to the right of the decimal point are the decimal portion and to
the left is the integer part
E.g. 10.75
10 is the Integer Portion and 0.75 is the decimal portion
The structure of a floating point(real) number is as follows:
4.2 * 108
Only the mantissa and the exponent are stored. The base is implied (known already)
As it is not stored this will save memory capacity
Floating Point Representation
Exponent
Mantissa Base
IEEE standard
There is a IEEE standard that defines the structure of a floating point number
IEEE Standard for Floating-Point Arithmetic (IEEE 754-2008)
It defines 4 main sizes of floating point numbers
16, 32, 64 and 128 bit
Sometimes referred to as Half, Single, Double and Quadruple precision
A 32 bit floating point number
S is a sign bit
0 = positive
1 = negative
23 bits for the mantissa
8 bits for the exponent
Sign Exponent Mantissa
1bit 8 bits 23 bits
Lets look at an example
We want the format of a number to be in
m x be
We want the mantissa to be a single decimal digit
Example
3450.00 = 3.45 x 103
The exponent is 3 as the decimal place has been moved 3 places to the left
Decimal fractions
First we will look at how a decimal number is made up: 173.75
Hundreds Tens Units Decimal
place
Tenth
s
Hundredths
1 7 3 . 7 5
102 101 100 Decimal
place
10-1 10-2
1 7 3 . 7 5
Binary fractions
Then look at how the same number could be stored in binary: 1010 1101
This number is constructed as shown above (in a fixed point notation).
These values come from
128 64 32 16 8 4 2 1 . 0.5 0.25
1 0 1 0 1 1 0 1 1 1
27 26 25 24 23 22 21 20 . 2-1 2-2
1 0 1 0 1 1 0 1 1 1
But the problem is
We don’t actually have a decimal point in binary...
A worked example
In decimal first
250.03125
First convert the integer part of the mantissa into binary (as you have done previously)
250 = 1111 1010
Now to convert the decimal portion of the mantissa
.03125
Example (cont)
Decimal fraction => .03125
Multiply and use any remainder over 1 as a carry forward. Continue until you reach 1.0
with no carry over
0.03125 * 2 = 0 r 0.0625
0.0625 * 2 = 0 r 0.125
0.125 * 2 = 0 r 0.25
0.25 * 2 = 0 r 0.5
0.5 * 2 = 1 r 0
Binary fraction = 0.00001
Read top to bottom
So far
So far we have : 1111 1010.00001 (250.03125)
But we need it in the format : .11111 0100 0001 (the decimal point to the left of the 1)
So the exponent is 8 (1000)
8 places to the left
1 1 1 1 1 0 1 0 . 0 0 0 0 1
. 1 1 1 1 1 0 1 0 0 0 0 0 1
Example
So back to our example
Mantissa =.11111 0100 0001 (2.5003125)
Exponent = 0000 1000 (8)
Sign Bit = 0
And the number is positive so the sign bit is 0
S Exponent Mantissa
0 0000 1000 11111 0100 000100000000000
1bit 8 bits 23 bits
In 32 bit representation there is
❏ 8 bits for the exponent
❏ 23 bits for the mantissa
We will pad the left of the exponent
with 0’s up to 8 bits
We will pad the right of the mantissa
with 0’s up to 23 bits
Further Example 1
102.9375
Sign = 0 (+ve) Integer = 102 = 1100110
Decimal portion = .1111 -> Number = 1100110.1111 -> Needs to be .11001101111
Exponent = 7 = 00000111
Number (32 bit Single Precision) = 0 00000111 11001101111000000000000
Further Example 2
250.75
Sign = 0 (+ve) Integer = 250 = 11111010
Decimal portion = .11 -> Number = 11111010.11 -> Needs to be .1111101011
Exponent = 8 = 00001000
Number (32 bit Single Precision) = 0 00001000 11111010110000000000000
What about small numbers?
What if we are storing 0.0625?
The decimal point doesn’t need moved to the left it needs moved to the right…
Example (cont)
Decimal fraction => .0625
Multiply and use any remainder over 1 as a carry forward. Continue until you reach 1.0
with no carry over
0.0625 * 2 = 0 r 0.125
0.125 * 2 = 0 r 0.25
0.25 * 2 = 0 r 0.5
0.5 * 2 = 1 r 0.0
Binary fraction = 0.001
Read top to bottom
So far
So far we have : 0.001 (0.0625)
But we need it in the format .10000000000000000000000
(leading bit after the . has to be a 1)
So the exponent is -2
2 places to the left
0 0 0 0 0 0 0 0 . 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 . 1 0 0
Example
So back to our example
Mantissa =0.1 (0.0625)
Exponent = 1111 1110 (-2)
Sign Bit = 0
And the number is positive so the sign bit is 0
S Exponent Mantissa
0 1111 1110 10000 0000 000000000000000
1bit 8 bits 23 bits
In 32 bit representation there is 23 bits
for the mantissa
We will pad the right of the number
with 0’s up to 23 bits
If the Exponent is negative
In reality there are other ways that this is dealt with (offset exponents for those that are
interested)
But for the purpose of the course we will store a negative exponent in 8 bit two’s
complement:
2 = 0000 0010
-2 = 1111 1110
What about really small numbers?
What if we are storing 0.0009765625?
The integer portion is 0
The decimal portion is: .0000000001
So our number need to be 0.1
We need to shift the exponent 10 places to the right
This means we need to store -10 as the exponent (two's complement)
Further Example 3
0.0009765625?
Sign = 0 (+ve) Integer = 0 = 0000000
Decimal portion = .0000000001 -> Number = 0.0000000001 -> Needs to be .1
Exponent = -10 = (+10 = 0000 1010) -10 = 1111 0110
Number (32 bit Single Precision) = 0 1111 0110 01000000000000000000000
Problems with floating point
What if we try to store 25.333?
We need much more bits in the mantissa to deal with this…
Increased Mantissa allocation
More bits allocated to
Mantissa
Increased
Accuracy/precision
Increased Exponent allocation
More bits allocated to
Exponent
Increased Range
Mnemonic
MARE – Mantissa Accuracy Range Exponent
Different Precision Numbers
Single Precision (32 bit)
Double precision (64 bit)
S Exponent Mantissa
1bit 8 bits 23 bits
1.18 × 10–38 to 3.40 × 1038
S Exponent Mantissa
1bit 11 bits 52 bits
2.23 × 10–308 to 1.79 × 10308
Summary
If you increase the amount of bits allocated to the Mantissa you increase the
accuracy/precision
If you increase the amount of bits allocated to the exponent you increase the range of
the number
Mnemonic
MARE - Mantissa Accuracy Range Exponent
Summary - Single precision Floating point
1. Create the mantissa portion (The integer part)
2. Create the decimal fraction
3. Calculate exponent by moving decimal point till number is in the format 1.xxxxx
4. Convert exponent to two’s complement if is negative (moving the point to the right)
5. Add the sign bit
0 = +ve
1 = -ive
6. Write in the format sign exponent mantissa

More Related Content

What's hot

Register transfer language
Register transfer languageRegister transfer language
Register transfer language
Sanjeev Patel
 
Quick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representationQuick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representation
Ritu Ranjan Shrivastwa
 
Instruction format
Instruction formatInstruction format
Instruction format
Sanjeev Patel
 
Representation of Integers
Representation of IntegersRepresentation of Integers
Representation of Integers
Susantha Herath
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codes
student
 
Data Representation
Data RepresentationData Representation
Data Representation
Dilum Bandara
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
Mahalakshmiv11
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
Mayank Garg
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
Janki Shah
 
Arithmetic circuits
Arithmetic circuitsArithmetic circuits
Arithmetic circuits
Sanjay Saluth
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmeticgavhays
 
Number system
Number systemNumber system
Number system
Sajib
 
Unit 1 data representation and computer arithmetic
Unit 1  data representation and computer arithmeticUnit 1  data representation and computer arithmetic
Unit 1 data representation and computer arithmetic
AmrutaMehata
 
Number system....
Number system....Number system....
Number system....mshoaib15
 
Binary to Decimal Conversion
Binary to Decimal ConversionBinary to Decimal Conversion
Binary to Decimal Conversion
Neelanjan Bhattacharyya
 
Multiplication algorithm, hardware and flowchart
Multiplication algorithm, hardware and flowchartMultiplication algorithm, hardware and flowchart
Multiplication algorithm, hardware and flowchart
Tanjarul Islam Mishu
 
Computer instructions
Computer instructionsComputer instructions
Computer instructionsAnuj Modi
 

What's hot (20)

Register transfer language
Register transfer languageRegister transfer language
Register transfer language
 
Number system conversion
Number system conversionNumber system conversion
Number system conversion
 
Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1
 
Quick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representationQuick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representation
 
Instruction format
Instruction formatInstruction format
Instruction format
 
Representation of Integers
Representation of IntegersRepresentation of Integers
Representation of Integers
 
06 floating point
06 floating point06 floating point
06 floating point
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codes
 
Data Representation
Data RepresentationData Representation
Data Representation
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
Arithmetic circuits
Arithmetic circuitsArithmetic circuits
Arithmetic circuits
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
Number system
Number systemNumber system
Number system
 
Unit 1 data representation and computer arithmetic
Unit 1  data representation and computer arithmeticUnit 1  data representation and computer arithmetic
Unit 1 data representation and computer arithmetic
 
Number system....
Number system....Number system....
Number system....
 
Binary to Decimal Conversion
Binary to Decimal ConversionBinary to Decimal Conversion
Binary to Decimal Conversion
 
Multiplication algorithm, hardware and flowchart
Multiplication algorithm, hardware and flowchartMultiplication algorithm, hardware and flowchart
Multiplication algorithm, hardware and flowchart
 
Computer instructions
Computer instructionsComputer instructions
Computer instructions
 

Similar to Floating point representation

3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt
RavikumarR77
 
Data representation in computers
Data representation in computersData representation in computers
Data representation in computers
Prof. Dr. K. Adisesha
 
Representation of Real Numbers
Representation of Real NumbersRepresentation of Real Numbers
Representation of Real Numbers
Forrester High School
 
Representation of Negative Numbers
Representation of Negative NumbersRepresentation of Negative Numbers
Representation of Negative Numbers
Forrester High School
 
Binary octal
Binary octalBinary octal
Binary octaldrdipo4
 
Number system
Number systemNumber system
Number system
Mantra VLSI
 
Computer Representation of Numbers and.pptx
Computer Representation of Numbers and.pptxComputer Representation of Numbers and.pptx
Computer Representation of Numbers and.pptx
Temesgen Geta
 
Chapter two FHI.pptx
Chapter two FHI.pptxChapter two FHI.pptx
Chapter two FHI.pptx
ODAATUBE1
 
lec2_BinaryArithmetic.ppt
lec2_BinaryArithmetic.pptlec2_BinaryArithmetic.ppt
lec2_BinaryArithmetic.ppt
AvijitChaudhuri3
 
DATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxDATA REPRESENTATION.pptx
DATA REPRESENTATION.pptx
MamataAnilgod
 
Chapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemChapter 2.1 introduction to number system
Chapter 2.1 introduction to number system
ISMT College
 
Number system
Number systemNumber system
Number system
Bikash Kumar
 
Lesson 1 basic theory of information
Lesson 1   basic theory of informationLesson 1   basic theory of information
Lesson 1 basic theory of informationRoma Kimberly Erolin
 
Lesson 1 basic theory of information
Lesson 1   basic theory of informationLesson 1   basic theory of information
Lesson 1 basic theory of informationRoma Kimberly Erolin
 
Chapter 02 Data Types
Chapter 02   Data TypesChapter 02   Data Types
Chapter 02 Data TypesNathan Yeung
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1
Deepak John
 
Int 2 data representation 2010
Int 2 data representation 2010Int 2 data representation 2010
Int 2 data representation 2010iarthur
 
number system
number systemnumber system
number system
Pawan Mishra
 

Similar to Floating point representation (20)

3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt
 
Data representation in computers
Data representation in computersData representation in computers
Data representation in computers
 
Representation of Real Numbers
Representation of Real NumbersRepresentation of Real Numbers
Representation of Real Numbers
 
09 Arithmetic
09  Arithmetic09  Arithmetic
09 Arithmetic
 
Representation of Negative Numbers
Representation of Negative NumbersRepresentation of Negative Numbers
Representation of Negative Numbers
 
Binary octal
Binary octalBinary octal
Binary octal
 
Number system
Number systemNumber system
Number system
 
Computer Representation of Numbers and.pptx
Computer Representation of Numbers and.pptxComputer Representation of Numbers and.pptx
Computer Representation of Numbers and.pptx
 
Chapter two FHI.pptx
Chapter two FHI.pptxChapter two FHI.pptx
Chapter two FHI.pptx
 
lec2_BinaryArithmetic.ppt
lec2_BinaryArithmetic.pptlec2_BinaryArithmetic.ppt
lec2_BinaryArithmetic.ppt
 
DATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxDATA REPRESENTATION.pptx
DATA REPRESENTATION.pptx
 
Sig fig and sci note
Sig fig and sci noteSig fig and sci note
Sig fig and sci note
 
Chapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemChapter 2.1 introduction to number system
Chapter 2.1 introduction to number system
 
Number system
Number systemNumber system
Number system
 
Lesson 1 basic theory of information
Lesson 1   basic theory of informationLesson 1   basic theory of information
Lesson 1 basic theory of information
 
Lesson 1 basic theory of information
Lesson 1   basic theory of informationLesson 1   basic theory of information
Lesson 1 basic theory of information
 
Chapter 02 Data Types
Chapter 02   Data TypesChapter 02   Data Types
Chapter 02 Data Types
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1
 
Int 2 data representation 2010
Int 2 data representation 2010Int 2 data representation 2010
Int 2 data representation 2010
 
number system
number systemnumber system
number system
 

More from missstevenson01

The Processor.pptx
The Processor.pptxThe Processor.pptx
The Processor.pptx
missstevenson01
 
How Computers Work
How Computers WorkHow Computers Work
How Computers Work
missstevenson01
 
Lesson 3 - Coding with Minecraft - Variables.pptx
Lesson 3 -  Coding with Minecraft -  Variables.pptxLesson 3 -  Coding with Minecraft -  Variables.pptx
Lesson 3 - Coding with Minecraft - Variables.pptx
missstevenson01
 
Lesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptxLesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptx
missstevenson01
 
Lesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptxLesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptx
missstevenson01
 
Lesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptxLesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptx
missstevenson01
 
Ethical hacking trojans, worms and spyware
Ethical hacking    trojans, worms and spywareEthical hacking    trojans, worms and spyware
Ethical hacking trojans, worms and spyware
missstevenson01
 
Ethical hacking anti virus
Ethical hacking   anti virusEthical hacking   anti virus
Ethical hacking anti virus
missstevenson01
 
Ethical hacking introduction to ethical hacking
Ethical hacking   introduction to ethical hackingEthical hacking   introduction to ethical hacking
Ethical hacking introduction to ethical hacking
missstevenson01
 
S1 internet safety-chattingonline
S1 internet safety-chattingonlineS1 internet safety-chattingonline
S1 internet safety-chattingonline
missstevenson01
 
S3 wireframe diagrams
S3 wireframe diagramsS3 wireframe diagrams
S3 wireframe diagrams
missstevenson01
 
Video Games and Copyright laws
Video Games and Copyright lawsVideo Games and Copyright laws
Video Games and Copyright laws
missstevenson01
 
Games Design Document
Games Design DocumentGames Design Document
Games Design Document
missstevenson01
 
Video game proposal
Video game proposalVideo game proposal
Video game proposal
missstevenson01
 
Evaluation
EvaluationEvaluation
Evaluation
missstevenson01
 
H evaluation
H evaluationH evaluation
H evaluation
missstevenson01
 
H testing and debugging
H testing and debuggingH testing and debugging
H testing and debugging
missstevenson01
 

More from missstevenson01 (20)

S3 environment
S3 environmentS3 environment
S3 environment
 
The Processor.pptx
The Processor.pptxThe Processor.pptx
The Processor.pptx
 
How Computers Work
How Computers WorkHow Computers Work
How Computers Work
 
Lesson 3 - Coding with Minecraft - Variables.pptx
Lesson 3 -  Coding with Minecraft -  Variables.pptxLesson 3 -  Coding with Minecraft -  Variables.pptx
Lesson 3 - Coding with Minecraft - Variables.pptx
 
Lesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptxLesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptx
 
Lesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptxLesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptx
 
Lesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptxLesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptx
 
Ethical hacking trojans, worms and spyware
Ethical hacking    trojans, worms and spywareEthical hacking    trojans, worms and spyware
Ethical hacking trojans, worms and spyware
 
Ethical hacking anti virus
Ethical hacking   anti virusEthical hacking   anti virus
Ethical hacking anti virus
 
Ethical hacking introduction to ethical hacking
Ethical hacking   introduction to ethical hackingEthical hacking   introduction to ethical hacking
Ethical hacking introduction to ethical hacking
 
S1 internet safety-chattingonline
S1 internet safety-chattingonlineS1 internet safety-chattingonline
S1 internet safety-chattingonline
 
S3 wireframe diagrams
S3 wireframe diagramsS3 wireframe diagrams
S3 wireframe diagrams
 
Sql
SqlSql
Sql
 
Alien database
Alien databaseAlien database
Alien database
 
Video Games and Copyright laws
Video Games and Copyright lawsVideo Games and Copyright laws
Video Games and Copyright laws
 
Games Design Document
Games Design DocumentGames Design Document
Games Design Document
 
Video game proposal
Video game proposalVideo game proposal
Video game proposal
 
Evaluation
EvaluationEvaluation
Evaluation
 
H evaluation
H evaluationH evaluation
H evaluation
 
H testing and debugging
H testing and debuggingH testing and debugging
H testing and debugging
 

Recently uploaded

How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 

Recently uploaded (20)

How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 

Floating point representation

  • 2. What about the other numbers? So far we know how to store integers Whole Numbers But what if we want to store real numbers Numbers with decimal fractions Even 27.5 needs another way to represent it. This method is called floating point representation
  • 3. Fixed Notation We are accustomed to using a fixed notation where the decimal point is fixed and we know that any numbers to the right of the decimal point are the decimal portion and to the left is the integer part E.g. 10.75 10 is the Integer Portion and 0.75 is the decimal portion
  • 4. The structure of a floating point(real) number is as follows: 4.2 * 108 Only the mantissa and the exponent are stored. The base is implied (known already) As it is not stored this will save memory capacity Floating Point Representation Exponent Mantissa Base
  • 5. IEEE standard There is a IEEE standard that defines the structure of a floating point number IEEE Standard for Floating-Point Arithmetic (IEEE 754-2008) It defines 4 main sizes of floating point numbers 16, 32, 64 and 128 bit Sometimes referred to as Half, Single, Double and Quadruple precision
  • 6. A 32 bit floating point number S is a sign bit 0 = positive 1 = negative 23 bits for the mantissa 8 bits for the exponent Sign Exponent Mantissa 1bit 8 bits 23 bits
  • 7. Lets look at an example We want the format of a number to be in m x be We want the mantissa to be a single decimal digit Example 3450.00 = 3.45 x 103 The exponent is 3 as the decimal place has been moved 3 places to the left
  • 8. Decimal fractions First we will look at how a decimal number is made up: 173.75 Hundreds Tens Units Decimal place Tenth s Hundredths 1 7 3 . 7 5 102 101 100 Decimal place 10-1 10-2 1 7 3 . 7 5
  • 9. Binary fractions Then look at how the same number could be stored in binary: 1010 1101 This number is constructed as shown above (in a fixed point notation). These values come from 128 64 32 16 8 4 2 1 . 0.5 0.25 1 0 1 0 1 1 0 1 1 1 27 26 25 24 23 22 21 20 . 2-1 2-2 1 0 1 0 1 1 0 1 1 1
  • 10. But the problem is We don’t actually have a decimal point in binary...
  • 11. A worked example In decimal first 250.03125 First convert the integer part of the mantissa into binary (as you have done previously) 250 = 1111 1010 Now to convert the decimal portion of the mantissa .03125
  • 12. Example (cont) Decimal fraction => .03125 Multiply and use any remainder over 1 as a carry forward. Continue until you reach 1.0 with no carry over 0.03125 * 2 = 0 r 0.0625 0.0625 * 2 = 0 r 0.125 0.125 * 2 = 0 r 0.25 0.25 * 2 = 0 r 0.5 0.5 * 2 = 1 r 0 Binary fraction = 0.00001 Read top to bottom
  • 13. So far So far we have : 1111 1010.00001 (250.03125) But we need it in the format : .11111 0100 0001 (the decimal point to the left of the 1) So the exponent is 8 (1000) 8 places to the left 1 1 1 1 1 0 1 0 . 0 0 0 0 1 . 1 1 1 1 1 0 1 0 0 0 0 0 1
  • 14. Example So back to our example Mantissa =.11111 0100 0001 (2.5003125) Exponent = 0000 1000 (8) Sign Bit = 0 And the number is positive so the sign bit is 0 S Exponent Mantissa 0 0000 1000 11111 0100 000100000000000 1bit 8 bits 23 bits In 32 bit representation there is ❏ 8 bits for the exponent ❏ 23 bits for the mantissa We will pad the left of the exponent with 0’s up to 8 bits We will pad the right of the mantissa with 0’s up to 23 bits
  • 15. Further Example 1 102.9375 Sign = 0 (+ve) Integer = 102 = 1100110 Decimal portion = .1111 -> Number = 1100110.1111 -> Needs to be .11001101111 Exponent = 7 = 00000111 Number (32 bit Single Precision) = 0 00000111 11001101111000000000000
  • 16. Further Example 2 250.75 Sign = 0 (+ve) Integer = 250 = 11111010 Decimal portion = .11 -> Number = 11111010.11 -> Needs to be .1111101011 Exponent = 8 = 00001000 Number (32 bit Single Precision) = 0 00001000 11111010110000000000000
  • 17. What about small numbers? What if we are storing 0.0625? The decimal point doesn’t need moved to the left it needs moved to the right…
  • 18. Example (cont) Decimal fraction => .0625 Multiply and use any remainder over 1 as a carry forward. Continue until you reach 1.0 with no carry over 0.0625 * 2 = 0 r 0.125 0.125 * 2 = 0 r 0.25 0.25 * 2 = 0 r 0.5 0.5 * 2 = 1 r 0.0 Binary fraction = 0.001 Read top to bottom
  • 19. So far So far we have : 0.001 (0.0625) But we need it in the format .10000000000000000000000 (leading bit after the . has to be a 1) So the exponent is -2 2 places to the left 0 0 0 0 0 0 0 0 . 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 . 1 0 0
  • 20. Example So back to our example Mantissa =0.1 (0.0625) Exponent = 1111 1110 (-2) Sign Bit = 0 And the number is positive so the sign bit is 0 S Exponent Mantissa 0 1111 1110 10000 0000 000000000000000 1bit 8 bits 23 bits In 32 bit representation there is 23 bits for the mantissa We will pad the right of the number with 0’s up to 23 bits
  • 21. If the Exponent is negative In reality there are other ways that this is dealt with (offset exponents for those that are interested) But for the purpose of the course we will store a negative exponent in 8 bit two’s complement: 2 = 0000 0010 -2 = 1111 1110
  • 22. What about really small numbers? What if we are storing 0.0009765625? The integer portion is 0 The decimal portion is: .0000000001 So our number need to be 0.1 We need to shift the exponent 10 places to the right This means we need to store -10 as the exponent (two's complement)
  • 23. Further Example 3 0.0009765625? Sign = 0 (+ve) Integer = 0 = 0000000 Decimal portion = .0000000001 -> Number = 0.0000000001 -> Needs to be .1 Exponent = -10 = (+10 = 0000 1010) -10 = 1111 0110 Number (32 bit Single Precision) = 0 1111 0110 01000000000000000000000
  • 24. Problems with floating point What if we try to store 25.333? We need much more bits in the mantissa to deal with this…
  • 25. Increased Mantissa allocation More bits allocated to Mantissa Increased Accuracy/precision
  • 26. Increased Exponent allocation More bits allocated to Exponent Increased Range
  • 27. Mnemonic MARE – Mantissa Accuracy Range Exponent
  • 28. Different Precision Numbers Single Precision (32 bit) Double precision (64 bit) S Exponent Mantissa 1bit 8 bits 23 bits 1.18 × 10–38 to 3.40 × 1038 S Exponent Mantissa 1bit 11 bits 52 bits 2.23 × 10–308 to 1.79 × 10308
  • 29. Summary If you increase the amount of bits allocated to the Mantissa you increase the accuracy/precision If you increase the amount of bits allocated to the exponent you increase the range of the number Mnemonic MARE - Mantissa Accuracy Range Exponent
  • 30. Summary - Single precision Floating point 1. Create the mantissa portion (The integer part) 2. Create the decimal fraction 3. Calculate exponent by moving decimal point till number is in the format 1.xxxxx 4. Convert exponent to two’s complement if is negative (moving the point to the right) 5. Add the sign bit 0 = +ve 1 = -ive 6. Write in the format sign exponent mantissa

Editor's Notes

  1. IEEE - Institute of Electrical and Electronics Engineers