SlideShare a Scribd company logo
1 of 22
Topic:
Implementation of character translation
integer and floating point values
Contents
•IEEE floating points
•Binary Representation of Floating Point
•Computer Representation of Floating Point Number
•Floating Point Representation
•Floating Point Precisions
•Floating Point Instructions
•Character Translation
IEEE Floating Point
IEEE Standard 754
• Established in 1985 as uniform standard for floating point
arithmetic
• Before that, many idiosyncratic formats
• Supported by all major CPUs
Driven by Numerical Concerns
• Nice standards for rounding, overflow, underflow
• Hard to make go fast
• Numerical analysts predominated over hardware types in defining standard
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.
Floating Point Representation
Numerical Form
• –1s M 2E
• Sign bit s determines whether number is negative or positive
• Significant M normally a fractional value in range [1.0,2.0).
• Exponent E weights value by power of two
Encoding
• MSB is sign bit
• exp field encodes E
• frac field encodes M
Floating Point Precisions
Encoding
• MSB is sign bit
• exp field encodes E
• frac field encodes M
Sizes
• Single precision: 8 exp bits, 23 frac bits
• 32 bits total
• Double precision: 11 exp bits, 52 frac bits
• 64 bits total
• Extended precision: 15 exp bits, 63 frac bits
• Only found in Intel-compatible machines
• Stored in 80 bits
• 1 bit wasted
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
FLOATING POINT INSTRUCTIONS
Floating point Architecture:
• 8 80-bit stack registers ST(0), ST(1), ..,ST(7)
(ST(0) can be abbreviated as ST)
To use the floating point stack, we:
• Push data from memory onto the stack
• Process data
• Pop data from stack to memory.
Example 1
X DD 3.4
Y DD 2 'This is an integer, while 2.0 is flt. pt.
Z DD ?
To evaluate Z = X + Y
FLD X ;ST(0) = X
FILD Y ;ST(0) = Y, ST(1) = X
FADD ;ST(0) = X + Y
FSTP Z ;Z = X + Y
Example 2
To evaluate X * Y - U / V
X DD 3.9
Y DD 2.8
U DD 7.3
V DD 4.62 ______code follows ___________
FLD X ;st(0) = X
FLD Y ;st(0) = Y, st(1) = X
FMUL ;st(0) = X*Y
FLD U ;st(0) = U, st(1) = X*Y
FLD V ;st(0) = V, st(1) = U, st(2) = X*Y
FDIV ;st(0) = U/V, st(1) = X*Y
FSUB ;st(0) = X*Y - U / V
FSTP Z ;Z = result, st(0) = empty
Util.lib contains the following subroutines for inputting and
outputting floating point numbers:
• GetFP This inputs a no. such as 33 or 3.56 from the
keyboard, and pushes it, in binary floating point form, onto the
floating point stack.
• PutFP This pops the number from the top of the floating
point stack, and outputs it to the keyboard in ASCII.
Character Translation
• Sometimes character data are available in one format.
• Need to be in another format for processing.
• Character are transmitted between two computers.
• One is used ASCII character and other normally using EBCDIC
character.
Implementation of character translation integer and floating point values

More Related Content

What's hot

Lec 02 data representation part 1
Lec 02 data representation part 1Lec 02 data representation part 1
Lec 02 data representation part 1Abdul Khan
 
Floating point representation
Floating point representationFloating point representation
Floating point representationmissstevenson01
 
Chapter 01 Basic Principles of Digital Systems
Chapter 01 Basic Principles of Digital SystemsChapter 01 Basic Principles of Digital Systems
Chapter 01 Basic Principles of Digital SystemsSSE_AndyLi
 
Data representation
Data representationData representation
Data representationMysore
 
CBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,NormalizationCBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,NormalizationAmberSinghal1
 
Encoder & Decoder
Encoder & DecoderEncoder & Decoder
Encoder & DecoderSyed Saeed
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsSSE_AndyLi
 
digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointdigital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointRai University
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentIJERD Editor
 
Finite word lenth effects
Finite word lenth effectsFinite word lenth effects
Finite word lenth effectstamil arasan
 
Data representation
 Data representation Data representation
Data representationAshraf Miraz
 
Decoders
DecodersDecoders
DecodersRe Man
 
Understand data representation on CPU 1
Understand data representation on CPU 1Understand data representation on CPU 1
Understand data representation on CPU 1Brenda Debra
 
Lec 02 data representation part 2
Lec 02 data representation part 2Lec 02 data representation part 2
Lec 02 data representation part 2Abdul Khan
 

What's hot (20)

Lec 02 data representation part 1
Lec 02 data representation part 1Lec 02 data representation part 1
Lec 02 data representation part 1
 
Class03
Class03Class03
Class03
 
Data Representation
Data RepresentationData Representation
Data Representation
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
Chapter 01 Basic Principles of Digital Systems
Chapter 01 Basic Principles of Digital SystemsChapter 01 Basic Principles of Digital Systems
Chapter 01 Basic Principles of Digital Systems
 
IEEE Floating Point
IEEE Floating PointIEEE Floating Point
IEEE Floating Point
 
Data representation
Data representationData representation
Data representation
 
CBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,NormalizationCBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,Normalization
 
Encoder & Decoder
Encoder & DecoderEncoder & Decoder
Encoder & Decoder
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
 
digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointdigital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed point
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
Finite word lenth effects
Finite word lenth effectsFinite word lenth effects
Finite word lenth effects
 
Arithmetic circuits
Arithmetic circuitsArithmetic circuits
Arithmetic circuits
 
Data representation
Data representationData representation
Data representation
 
07Decoders121
07Decoders12107Decoders121
07Decoders121
 
Data representation
 Data representation Data representation
Data representation
 
Decoders
DecodersDecoders
Decoders
 
Understand data representation on CPU 1
Understand data representation on CPU 1Understand data representation on CPU 1
Understand data representation on CPU 1
 
Lec 02 data representation part 2
Lec 02 data representation part 2Lec 02 data representation part 2
Lec 02 data representation part 2
 

Similar to Implementation of character translation integer and floating point values

Only floating point lecture 7 (1)
Only floating point lecture 7 (1)Only floating point lecture 7 (1)
Only floating point lecture 7 (1)talhashahid40
 
IEEE-754 standard format to handle Floating-Point calculations in RISC-V CPUs...
IEEE-754 standard format to handle Floating-Point calculations in RISC-V CPUs...IEEE-754 standard format to handle Floating-Point calculations in RISC-V CPUs...
IEEE-754 standard format to handle Floating-Point calculations in RISC-V CPUs...zeeshanshanzy009
 
Fixed Point Conversion
Fixed Point ConversionFixed Point Conversion
Fixed Point ConversionRajesh Sharma
 
Number system and codes
Number system and codesNumber system and codes
Number system and codesAbhiraj Bohra
 
Unit 1 PDF.pptx
Unit 1 PDF.pptxUnit 1 PDF.pptx
Unit 1 PDF.pptxChandraV13
 
Digital electronics-Introduction.pptx
Digital electronics-Introduction.pptxDigital electronics-Introduction.pptx
Digital electronics-Introduction.pptxSubrata Maiti
 
Chapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptChapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptAparnaDas827261
 
Kaizen cso002 l1
Kaizen cso002 l1Kaizen cso002 l1
Kaizen cso002 l1asslang
 
Bitwise Operations(1).pdf
Bitwise Operations(1).pdfBitwise Operations(1).pdf
Bitwise Operations(1).pdfDalvinCalvin
 
Chapter 3-Data Representation in Computers.ppt
Chapter 3-Data Representation in Computers.pptChapter 3-Data Representation in Computers.ppt
Chapter 3-Data Representation in Computers.pptKalGetachew2
 
Finite word length effects
Finite word length effectsFinite word length effects
Finite word length effectsPeriyanayagiS
 

Similar to Implementation of character translation integer and floating point values (20)

Only floating point lecture 7 (1)
Only floating point lecture 7 (1)Only floating point lecture 7 (1)
Only floating point lecture 7 (1)
 
IEEE-754 standard format to handle Floating-Point calculations in RISC-V CPUs...
IEEE-754 standard format to handle Floating-Point calculations in RISC-V CPUs...IEEE-754 standard format to handle Floating-Point calculations in RISC-V CPUs...
IEEE-754 standard format to handle Floating-Point calculations in RISC-V CPUs...
 
Fixed Point Conversion
Fixed Point ConversionFixed Point Conversion
Fixed Point Conversion
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
 
Number Systems.ppt
Number Systems.pptNumber Systems.ppt
Number Systems.ppt
 
Unit 1 PDF.pptx
Unit 1 PDF.pptxUnit 1 PDF.pptx
Unit 1 PDF.pptx
 
Digital electronics-Introduction.pptx
Digital electronics-Introduction.pptxDigital electronics-Introduction.pptx
Digital electronics-Introduction.pptx
 
Digital Logic
Digital LogicDigital Logic
Digital Logic
 
Chapter-04.pdf
Chapter-04.pdfChapter-04.pdf
Chapter-04.pdf
 
3-Block Ciphers and DES.pdf
3-Block Ciphers and DES.pdf3-Block Ciphers and DES.pdf
3-Block Ciphers and DES.pdf
 
Coa presentation1
Coa presentation1Coa presentation1
Coa presentation1
 
Chapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptChapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.ppt
 
Ieee+floating
Ieee+floatingIeee+floating
Ieee+floating
 
Kaizen cso002 l1
Kaizen cso002 l1Kaizen cso002 l1
Kaizen cso002 l1
 
Bitwise Operations(1).pdf
Bitwise Operations(1).pdfBitwise Operations(1).pdf
Bitwise Operations(1).pdf
 
Chapter 3-Data Representation in Computers.ppt
Chapter 3-Data Representation in Computers.pptChapter 3-Data Representation in Computers.ppt
Chapter 3-Data Representation in Computers.ppt
 
Finite word length effects
Finite word length effectsFinite word length effects
Finite word length effects
 
1. basic theories of information
1. basic theories of information1. basic theories of information
1. basic theories of information
 
DLD-Introduction.pptx
DLD-Introduction.pptxDLD-Introduction.pptx
DLD-Introduction.pptx
 
Counit2
Counit2Counit2
Counit2
 

Recently uploaded

Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Radiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsRadiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsstephieert
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneCall girls in Ahmedabad High profile
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Sheetaleventcompany
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Roomgirls4nights
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 

Recently uploaded (20)

Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Radiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsRadiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girls
 
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 

Implementation of character translation integer and floating point values

  • 1. Topic: Implementation of character translation integer and floating point values
  • 2. Contents •IEEE floating points •Binary Representation of Floating Point •Computer Representation of Floating Point Number •Floating Point Representation •Floating Point Precisions •Floating Point Instructions •Character Translation
  • 3. IEEE Floating Point IEEE Standard 754 • Established in 1985 as uniform standard for floating point arithmetic • Before that, many idiosyncratic formats • Supported by all major CPUs Driven by Numerical Concerns • Nice standards for rounding, overflow, underflow • Hard to make go fast • Numerical analysts predominated over hardware types in defining standard
  • 4. 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)
  • 5. 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
  • 6. 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
  • 7. • 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
  • 8. 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
  • 9. • 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...
  • 10. 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.
  • 11. •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.
  • 12. • 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.
  • 13. Floating Point Representation Numerical Form • –1s M 2E • Sign bit s determines whether number is negative or positive • Significant M normally a fractional value in range [1.0,2.0). • Exponent E weights value by power of two Encoding • MSB is sign bit • exp field encodes E • frac field encodes M
  • 14. Floating Point Precisions Encoding • MSB is sign bit • exp field encodes E • frac field encodes M Sizes • Single precision: 8 exp bits, 23 frac bits • 32 bits total • Double precision: 11 exp bits, 52 frac bits • 64 bits total • Extended precision: 15 exp bits, 63 frac bits • Only found in Intel-compatible machines • Stored in 80 bits • 1 bit wasted
  • 15. 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
  • 16. 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
  • 17. FLOATING POINT INSTRUCTIONS Floating point Architecture: • 8 80-bit stack registers ST(0), ST(1), ..,ST(7) (ST(0) can be abbreviated as ST) To use the floating point stack, we: • Push data from memory onto the stack • Process data • Pop data from stack to memory.
  • 18. Example 1 X DD 3.4 Y DD 2 'This is an integer, while 2.0 is flt. pt. Z DD ? To evaluate Z = X + Y FLD X ;ST(0) = X FILD Y ;ST(0) = Y, ST(1) = X FADD ;ST(0) = X + Y FSTP Z ;Z = X + Y
  • 19. Example 2 To evaluate X * Y - U / V X DD 3.9 Y DD 2.8 U DD 7.3 V DD 4.62 ______code follows ___________ FLD X ;st(0) = X FLD Y ;st(0) = Y, st(1) = X FMUL ;st(0) = X*Y FLD U ;st(0) = U, st(1) = X*Y FLD V ;st(0) = V, st(1) = U, st(2) = X*Y FDIV ;st(0) = U/V, st(1) = X*Y FSUB ;st(0) = X*Y - U / V FSTP Z ;Z = result, st(0) = empty
  • 20. Util.lib contains the following subroutines for inputting and outputting floating point numbers: • GetFP This inputs a no. such as 33 or 3.56 from the keyboard, and pushes it, in binary floating point form, onto the floating point stack. • PutFP This pops the number from the top of the floating point stack, and outputs it to the keyboard in ASCII.
  • 21. Character Translation • Sometimes character data are available in one format. • Need to be in another format for processing. • Character are transmitted between two computers. • One is used ASCII character and other normally using EBCDIC character.