SlideShare a Scribd company logo
1 of 4
Conversion Procedure
The rules for converting a decimal number into floating point are as follows:
A. Convert the absolute value of the number to binary, perhaps with a fractional
part after the binary point. This can be done by converting the integral and
fractional parts separately. The integral part is converted with the techniques
examined previously. The fractional part can be converted by multiplication.
This is basically the inverse of the division method: we repeatedly multiply by
2, and harvest each one bit as it appears left of the decimal.
B. Append × 20 to the end of the binary number (which does not change its value).
C. Normalize the number. Move the binary point so that it is one bit from the left.
Adjust the exponent of two so that the value does not change.
D. Place the mantissa into the mantissa field of the number. Omit the leading one,
and fill with zeros on the right.
E. Add the bias to the exponent of two, and place it in the exponent field. The bias
is 2k−1 − 1, where k is the number of bits in the exponent field. For the eight-bit
format, k = 3, so the bias is 23−1 − 1 = 3. For IEEE 32-bit, k = 8, so the bias is
28−1 − 1 = 127.
F. Set the sign bit, 1 for negative, 0 for positive, according to the sign of the
original number.
Using The Conversion Procedure
 Convert 2.625 to our 8-bit floating point format.
A. The integral part is easy, 210 = 102. For the fractional part:
0.625 × 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
B. So 0.62510 = 0.1012, and 2.62510 = 10.1012.
C. Add an exponent part: 10.1012 = 10.1012 × 20.
D. Normalize: 10.1012 × 20 = 1.01012 × 21.
E. Mantissa: 0101
F. Exponent: 1 + 3 = 4 = 1002.
G. Sign bit is 0.
The result is 01000101. Represented as hex, that is 4516.
 Convert -4.75 to our 8-bit floating point format.
a. The integral part is 410 = 1002. The fractional:
0.75 × 2 = 1.5 1 Generate 1 and continue with the rest.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
b. So 4.7510 = 100.112.
c. Normalize: 100.112 = 1.00112 × 22.
d. Mantissa is 0011, exponent is 2 + 3 = 5 = 1012, sign bit is 1.
So -4.75 is 11010011 = d316
Convert 0.40625 to our 8-bit floating point format.
. Converting:
0.40625 × 2 = 0.8125 0 Generate 0 and continue.
0.8125 × 2 = 1.625 1 Generate 1 and continue with the rest.
0.625 × 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
a. So 0.4062510 = 0.011012.
b. Normalize: 0.011012 = 1.1012 × 2-2.
c. Mantissa is 1010, exponent is -2 + 3 = 1 = 0012, sign bit is 0.
So 0.40625 is 00011010 = 1a16
Convert -12.0 to our 8-bit floating point format.
. 1210 = 11002.
a. Normalize: 1100.02 = 1.12 × 23.
b. Mantissa is 1000, exponent is 3 + 3 = 6 = 1102, sign bit is 1.
So -12.0 is 11101000 = e816
Convert decimal 1.7 to our 8-bit floating point format.
. The integral part is easy, 110 = 12. For the fractional part:
0.7 × 2 = 1.4 1 Generate 1 and continue with the rest.
0.4 × 2 = 0.8 0 Generate 0 and continue.
0.8 × 2 = 1.6 1 Generate 1 and continue with the rest.
0.6 × 2 = 1.2 1 Generate 1 and continue with the rest.
0.2 × 2 = 0.4 0 Generate 0 and continue.
0.4 × 2 = 0.8 0 Generate 0 and continue.
0.8 × 2 = 1.6 1 Generate 1 and continue with the rest.
0.6 × 2 = 1.2 1 Generate 1 and continue with the rest.
…
a. The reason why the process seems to continue endlessly is that it does.
The number 7/10, which makes a perfectly reasonable decimal fraction,
is a repeating fraction in binary, just as the faction 1/3 is a repeating
fraction in decimal. (It repeats in binary as well.) We cannot represent
this exactly as a floating point number. The closest we can come in four
bits is .1011. Since we already have a leading 1, the best eight-bit
number we can make is 1.1011.
b. Already normalized: 1.10112 = 1.10112 × 20.
c. Mantissa is 1011, exponent is 0 + 3 = 3 = 0112, sign bit is 0.
The result is 00111011 = 3b16. This is not exact, of course. If you convert it
back to decimal, you get 1.6875.
Convert -1313.3125 to IEEE 32-bit floating point format.
. The integral part is 131310 = 101001000012. The fractional:
0.3125 × 2 = 0.625 0 Generate 0 and continue.
0.625 × 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
a. So 1313.312510 = 10100100001.01012.
b. Normalize: 10100100001.01012 = 1.010010000101012 × 210.
c. Mantissa is 01001000010101000000000, exponent is 10 + 127 = 137 =
100010012, sign bit is 1.
So -1313.3125 is 11000100101001000010101000000000 = c4a42a0016
Convert 0.1015625 to IEEE 32-bit floating point format.
. Converting:
0.1015625 × 2 = 0.203125 0 Generate 0 and continue.
0.203125 × 2 = 0.40625 0 Generate 0 and continue.
0.40625 × 2 = 0.8125 0 Generate 0 and continue.
0.8125 × 2 = 1.625 1 Generate 1 and continue with the rest.
0.625 × 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
a. So 0.101562510 = 0.00011012.
b. Normalize: 0.00011012 = 1.1012 × 2-4.
c. Mantissa is 10100000000000000000000, exponent is -4 + 127 = 123 =
011110112, sign bit is 0.
So 0.1015625 is 00111101110100000000000000000000 = 3dd0000016
Convert 39887.5625 to IEEE 32-bit floating point format.
. The integral part is 3988710 = 10011011110011112. The fractional:
0.5625 × 2 = 1.125 1 Generate 1 and continue with the rest.
0.125 × 2 = 0.25 0 Generate 0 and continue.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
a. So 39887.562510 = 1001101111001111.10012.
b. Normalize: 1001101111001111.10012 = 1.00110111100111110012 ×
215.
c. Mantissa is 00110111100111110010000, exponent is 15 + 127 = 142 =
100011102, sign bit is 0.
So 39887.5625 is 01000111000110111100111110010000 = 471bcf9016

More Related Content

What's hot

Expressing Rational Numbers from Decimal Form to Fraction Form
Expressing Rational Numbers from Decimal Form to Fraction FormExpressing Rational Numbers from Decimal Form to Fraction Form
Expressing Rational Numbers from Decimal Form to Fraction FormFloroQPalomerasJr
 
Decimal to binary number
Decimal to binary numberDecimal to binary number
Decimal to binary numberguestd8696a
 
Complements of numbers
Complements of numbersComplements of numbers
Complements of numbersKiriti Varkur
 
Binary octal
Binary octalBinary octal
Binary octaldrdipo4
 
Convertion of single precision
Convertion of single precisionConvertion of single precision
Convertion of single precisionnikhilarora2211
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rulesstudent
 
Floating point representation
Floating point representation Floating point representation
Floating point representation SVisnuDharsini
 
Data types - things you have to know!
Data types - things you have to know!Data types - things you have to know!
Data types - things you have to know!Karol Sobiesiak
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complementsarunachalamr16
 
Floating point representation
Floating point representationFloating point representation
Floating point representationmissstevenson01
 

What's hot (20)

1s and 2s complement
1s and 2s complement1s and 2s complement
1s and 2s complement
 
Expressing Rational Numbers from Decimal Form to Fraction Form
Expressing Rational Numbers from Decimal Form to Fraction FormExpressing Rational Numbers from Decimal Form to Fraction Form
Expressing Rational Numbers from Decimal Form to Fraction Form
 
Decimal to binary number
Decimal to binary numberDecimal to binary number
Decimal to binary number
 
Floating Point Numbers
Floating Point NumbersFloating Point Numbers
Floating Point Numbers
 
Complements of numbers
Complements of numbersComplements of numbers
Complements of numbers
 
Binary octal
Binary octalBinary octal
Binary octal
 
Division process for STD-III
Division process for STD-IIIDivision process for STD-III
Division process for STD-III
 
Convertion of single precision
Convertion of single precisionConvertion of single precision
Convertion of single precision
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rules
 
Digital logic mohammed salim ch2
Digital logic mohammed salim ch2Digital logic mohammed salim ch2
Digital logic mohammed salim ch2
 
Binary true ppt
Binary true pptBinary true ppt
Binary true ppt
 
Binary operations
 Binary operations Binary operations
Binary operations
 
Floating point representation
Floating point representation Floating point representation
Floating point representation
 
Bin to dec.21
Bin to dec.21Bin to dec.21
Bin to dec.21
 
2's complement
2's complement2's complement
2's complement
 
Data types - things you have to know!
Data types - things you have to know!Data types - things you have to know!
Data types - things you have to know!
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complements
 
IEEE Floating Point
IEEE Floating PointIEEE Floating Point
IEEE Floating Point
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
B sc ii sem unit 2(a) ns
B sc ii sem  unit 2(a) nsB sc ii sem  unit 2(a) ns
B sc ii sem unit 2(a) ns
 

Similar to Floting point representation

digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptxsulekhasaxena2
 
Data representation
Data representationData representation
Data representationChew Hoong
 
Lesson plan on data representation
Lesson plan on data representationLesson plan on data representation
Lesson plan on data representationPooja Tripathi
 
NumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdfNumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdfMarzCasipong1
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptskatiarrahaman
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptRabiaAsif31
 
Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)Frankie Jones
 
number system: Floating Point representation.ppt
number system: Floating Point representation.pptnumber system: Floating Point representation.ppt
number system: Floating Point representation.pptNARENDRAKUMARCHAURAS1
 
Converting repeating , non terminating decimals
Converting repeating , non terminating decimalsConverting repeating , non terminating decimals
Converting repeating , non terminating decimalsMartinGeraldine
 
Binary Coded Decimal.pptx
Binary Coded Decimal.pptxBinary Coded Decimal.pptx
Binary Coded Decimal.pptxssuserb0a163
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptssuser52a19e
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalUtkirjonUbaydullaev1
 

Similar to Floting point representation (20)

Number system
Number systemNumber system
Number system
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
 
200203 answers01
200203 answers01200203 answers01
200203 answers01
 
Data representation
Data representationData representation
Data representation
 
Lesson plan on data representation
Lesson plan on data representationLesson plan on data representation
Lesson plan on data representation
 
Chapter 1
Chapter   1Chapter   1
Chapter 1
 
Floating point arithmetic
Floating point arithmeticFloating point arithmetic
Floating point arithmetic
 
NumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdfNumberSystemsAnnotated.pdf
NumberSystemsAnnotated.pdf
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.ppt
 
Number Systems Basic Concepts
Number Systems Basic ConceptsNumber Systems Basic Concepts
Number Systems Basic Concepts
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)
 
number system: Floating Point representation.ppt
number system: Floating Point representation.pptnumber system: Floating Point representation.ppt
number system: Floating Point representation.ppt
 
Converting repeating , non terminating decimals
Converting repeating , non terminating decimalsConverting repeating , non terminating decimals
Converting repeating , non terminating decimals
 
Binary Coded Decimal.pptx
Binary Coded Decimal.pptxBinary Coded Decimal.pptx
Binary Coded Decimal.pptx
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
binary-numbers.ppt
binary-numbers.pptbinary-numbers.ppt
binary-numbers.ppt
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and Hexadecimal
 

Recently uploaded

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 

Floting point representation

  • 1. Conversion Procedure The rules for converting a decimal number into floating point are as follows: A. Convert the absolute value of the number to binary, perhaps with a fractional part after the binary point. This can be done by converting the integral and fractional parts separately. The integral part is converted with the techniques examined previously. The fractional part can be converted by multiplication. This is basically the inverse of the division method: we repeatedly multiply by 2, and harvest each one bit as it appears left of the decimal. B. Append × 20 to the end of the binary number (which does not change its value). C. Normalize the number. Move the binary point so that it is one bit from the left. Adjust the exponent of two so that the value does not change. D. Place the mantissa into the mantissa field of the number. Omit the leading one, and fill with zeros on the right. E. Add the bias to the exponent of two, and place it in the exponent field. The bias is 2k−1 − 1, where k is the number of bits in the exponent field. For the eight-bit format, k = 3, so the bias is 23−1 − 1 = 3. For IEEE 32-bit, k = 8, so the bias is 28−1 − 1 = 127. F. Set the sign bit, 1 for negative, 0 for positive, according to the sign of the original number. Using The Conversion Procedure  Convert 2.625 to our 8-bit floating point format. A. The integral part is easy, 210 = 102. For the fractional part: 0.625 × 2 = 1.25 1 Generate 1 and continue with the rest. 0.25 × 2 = 0.5 0 Generate 0 and continue. 0.5 × 2 = 1.0 1 Generate 1 and nothing remains. B. So 0.62510 = 0.1012, and 2.62510 = 10.1012. C. Add an exponent part: 10.1012 = 10.1012 × 20. D. Normalize: 10.1012 × 20 = 1.01012 × 21. E. Mantissa: 0101 F. Exponent: 1 + 3 = 4 = 1002. G. Sign bit is 0. The result is 01000101. Represented as hex, that is 4516.  Convert -4.75 to our 8-bit floating point format. a. The integral part is 410 = 1002. The fractional:
  • 2. 0.75 × 2 = 1.5 1 Generate 1 and continue with the rest. 0.5 × 2 = 1.0 1 Generate 1 and nothing remains. b. So 4.7510 = 100.112. c. Normalize: 100.112 = 1.00112 × 22. d. Mantissa is 0011, exponent is 2 + 3 = 5 = 1012, sign bit is 1. So -4.75 is 11010011 = d316 Convert 0.40625 to our 8-bit floating point format. . Converting: 0.40625 × 2 = 0.8125 0 Generate 0 and continue. 0.8125 × 2 = 1.625 1 Generate 1 and continue with the rest. 0.625 × 2 = 1.25 1 Generate 1 and continue with the rest. 0.25 × 2 = 0.5 0 Generate 0 and continue. 0.5 × 2 = 1.0 1 Generate 1 and nothing remains. a. So 0.4062510 = 0.011012. b. Normalize: 0.011012 = 1.1012 × 2-2. c. Mantissa is 1010, exponent is -2 + 3 = 1 = 0012, sign bit is 0. So 0.40625 is 00011010 = 1a16 Convert -12.0 to our 8-bit floating point format. . 1210 = 11002. a. Normalize: 1100.02 = 1.12 × 23. b. Mantissa is 1000, exponent is 3 + 3 = 6 = 1102, sign bit is 1. So -12.0 is 11101000 = e816 Convert decimal 1.7 to our 8-bit floating point format. . The integral part is easy, 110 = 12. For the fractional part: 0.7 × 2 = 1.4 1 Generate 1 and continue with the rest. 0.4 × 2 = 0.8 0 Generate 0 and continue. 0.8 × 2 = 1.6 1 Generate 1 and continue with the rest. 0.6 × 2 = 1.2 1 Generate 1 and continue with the rest. 0.2 × 2 = 0.4 0 Generate 0 and continue. 0.4 × 2 = 0.8 0 Generate 0 and continue. 0.8 × 2 = 1.6 1 Generate 1 and continue with the rest.
  • 3. 0.6 × 2 = 1.2 1 Generate 1 and continue with the rest. … a. The reason why the process seems to continue endlessly is that it does. The number 7/10, which makes a perfectly reasonable decimal fraction, is a repeating fraction in binary, just as the faction 1/3 is a repeating fraction in decimal. (It repeats in binary as well.) We cannot represent this exactly as a floating point number. The closest we can come in four bits is .1011. Since we already have a leading 1, the best eight-bit number we can make is 1.1011. b. Already normalized: 1.10112 = 1.10112 × 20. c. Mantissa is 1011, exponent is 0 + 3 = 3 = 0112, sign bit is 0. The result is 00111011 = 3b16. This is not exact, of course. If you convert it back to decimal, you get 1.6875. Convert -1313.3125 to IEEE 32-bit floating point format. . The integral part is 131310 = 101001000012. The fractional: 0.3125 × 2 = 0.625 0 Generate 0 and continue. 0.625 × 2 = 1.25 1 Generate 1 and continue with the rest. 0.25 × 2 = 0.5 0 Generate 0 and continue. 0.5 × 2 = 1.0 1 Generate 1 and nothing remains. a. So 1313.312510 = 10100100001.01012. b. Normalize: 10100100001.01012 = 1.010010000101012 × 210. c. Mantissa is 01001000010101000000000, exponent is 10 + 127 = 137 = 100010012, sign bit is 1. So -1313.3125 is 11000100101001000010101000000000 = c4a42a0016 Convert 0.1015625 to IEEE 32-bit floating point format. . Converting: 0.1015625 × 2 = 0.203125 0 Generate 0 and continue. 0.203125 × 2 = 0.40625 0 Generate 0 and continue. 0.40625 × 2 = 0.8125 0 Generate 0 and continue. 0.8125 × 2 = 1.625 1 Generate 1 and continue with the rest. 0.625 × 2 = 1.25 1 Generate 1 and continue with the rest. 0.25 × 2 = 0.5 0 Generate 0 and continue. 0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
  • 4. a. So 0.101562510 = 0.00011012. b. Normalize: 0.00011012 = 1.1012 × 2-4. c. Mantissa is 10100000000000000000000, exponent is -4 + 127 = 123 = 011110112, sign bit is 0. So 0.1015625 is 00111101110100000000000000000000 = 3dd0000016 Convert 39887.5625 to IEEE 32-bit floating point format. . The integral part is 3988710 = 10011011110011112. The fractional: 0.5625 × 2 = 1.125 1 Generate 1 and continue with the rest. 0.125 × 2 = 0.25 0 Generate 0 and continue. 0.25 × 2 = 0.5 0 Generate 0 and continue. 0.5 × 2 = 1.0 1 Generate 1 and nothing remains. a. So 39887.562510 = 1001101111001111.10012. b. Normalize: 1001101111001111.10012 = 1.00110111100111110012 × 215. c. Mantissa is 00110111100111110010000, exponent is 15 + 127 = 142 = 100011102, sign bit is 0. So 39887.5625 is 01000111000110111100111110010000 = 471bcf9016