SlideShare a Scribd company logo
1 of 17
Download to read offline
Carc 02.02
alessandro.bogliolo@uniurb.it
02. Binary representations
02.02. Numerical sets and binary arithmetic
• Positional notation
• Unsigned integers
• Unsigned fixed-point
• Signed numbers
• Floating point numbers
• Base conversions
• Binary arithmetic
Computer Architecture
alessandro.bogliolo@uniurb.it
Carc 02.02
alessandro.bogliolo@uniurb.it
Positional notation
of unsigned integers
0
0
1
1
2
2
1
1 ... bcbcbcbc n
n
n
n  



0121 ... cccc nn 
• The base-b positional representation of an
integer number of n digits has the form
• The value of the number is
• n digits encode all integer numbers from 0 to
bn-1
Example:
b=2, n=5 10011=1*16+1*2+1*1=19
11111=31=25-1
(1)
(2)
Carc 02.02
alessandro.bogliolo@uniurb.it
Base conversion
0
0
1
1
2
2
1
1 ... bcbcbcbc n
n
n
n  



• From base b to decimal:
• From decimal to base b:
digits from c0 to cn-1 are obtained as
remainders of subsequent divisions by b of
the digital number
0
0
1
3
2
2
1
0
0
1
1
2
2
1
1
cb)bc...bcbc(
bcbc...bcbc
n
n
n
n
n
n
n
n










(2)
(3)
Carc 02.02
alessandro.bogliolo@uniurb.it
Base conversion
example
(29)(10)=(11101)(2) (11001)(2)=(25)(10)
29
29 14 1 29=14*2+1
14 7 0 14=7*2+0
7 3 1 7=3*2+1
3 1 1 3=1*2+1
1 0 1 1=0*2+1
position
digit
weight
0 1 1 1 +
1 0 2 0 +
2 0 4 0 +
3 1 8 8 +
4 1 16 16
25
Carc 02.02
alessandro.bogliolo@uniurb.it
Fixed-point notation of
unsigned rational numbers
m
m
n
n
n
n bc...bcbcbc...bcbc 






  1
1
0
0
1
1
2
2
1
1
mnn c...c.cc...cc  10121
• The base-b positional representation of a
rational number of n+m digits has the form
• The value of the number is
• n+m digits encode all rational numbers of the
form
m
Num
2
with 120  mn
Num
(4)
(5)
(6)
Carc 02.02
alessandro.bogliolo@uniurb.it
Base conversion
• From base b to decimal:
• From decimal to base b:
– Solution 1: Given a digital number X=Num/2m,
convert Num and shift the decimal point m
positions left
– Solution 2: Given a digital number X=Xint.Xfrac,
convert the integer part Xint as outlined before,
then convert the fractional part Xfrac obtaining each
digit as the integer part of the result of subsequent
multiplications by b:
m
m
n
n
n
n bc...bcbcbc...bcbc 






  1
1
0
0
1
1
2
2
1
1
11
21
2
2
1
1









  m
m
m
m bc...bccb)bc...bcbc( (7)
(5)
Carc 02.02
alessandro.bogliolo@uniurb.it
Base conversion
example
(29.375)(10)=(11101.011)(2)
29
29 14 1 29=14*2+1
14 7 0 14=7*2+0
7 3 1 7=3*2+1
3 1 1 3=1*2+1
1 0 1 1=0*2+1
0.375 *2 = 0.75 = 0 + 0.75
0.75 *2 = 1.5 = 1 + 0.5
0.5 *2 = 1 = 1 + 0
Carc 02.02
alessandro.bogliolo@uniurb.it
Binary arithmetic
• Binary addition:
• Binary multiplication:
0 1
0 0 1
1 1 10
1 1 1 1
1 5 0 1 1 1 1
6 0 0 1 1 0
2 1 1 0 1 0 1
0 1
0 0 0
1 0 1
1 2
1 5
6 0
1 2 -
1 8 0
1 1 1
1 1 0 0
1 1 1 1
1 1 0 0
1 1 0 0 -
1 1 0 0 - -
1 1 0 0 - - -
1 0 1 1 0 1 0 0
Carc 02.02
alessandro.bogliolo@uniurb.it
Signed numbers
• Sign bit: 0=positive, 1=negative
(3)(10) = 0 0011; (-3)(10) = 1 0011
• 1’s complement
(3)(10) = 0 0011; (-3)(10) = 1 1100 = (0 0011)’
• 2’s complement
(3)(10) = 0 0011; (-3)(10) = 1 1101 = (0 0011)’+1
Carc 02.02
alessandro.bogliolo@uniurb.it
2’s complement numbers
• The 2’s complement representation of a negative
number (say, -v) is obtained from the representation of
v, by complementing each bit (including the sign bit)
and adding 1
-vv’+1
• The resulting binary configuration corresponds to the
unsigned number 2n-v (i.e., the complement of v to 2n),
where n is the total number of digits, including the sign
bit.
0
2n
v-v
2n-v
positive
negative
Carc 02.02
alessandro.bogliolo@uniurb.it
2’s complement arithmetic
• 2’s complement numbers can be added by using the
conventional rules of binary addition
a+(-b)  a+(2n-b)=2n-(b-a)-(b-a)=a-b
• Example:
(3)(10)-(5)(10)
(00011)(2)-(00101)(2) = (00011)(2)+(-00101)(2)
(00011)(2c)+(11011)(2c) = (11110)(2c)
(-00010)(2)
(-2)(10)
Carc 02.02
alessandro.bogliolo@uniurb.it
Floating point numbers
• s = sign (1 bit)
• M = Mantissa (m bits)
• b = base (0 bits)
• se = exponent sign (1 bit)
• E = exponent (e bits)
Encoding floating point numbers requires
words of n digits, with n=1+m+1+e
s0.MbseE
Carc 02.02
alessandro.bogliolo@uniurb.it
Floating point encoding
1. Start from a fixed-point binary encoding using a
sufficient number of bits
2. Evaluate the number of shifts required to bring the
most significant 1 in position –1
3. Take as mantissa (M) the most significant m bits
(starting from the first 1) of the fixed-point encoding
4. Set se=1 if the number is lower than 0.5, se=0
otherwise
5. Assign the exponent E with the binary
representation of the number of shifts computed at
step 2
6. Set the sign bit s as usual
s0.MbseE
Carc 02.02
alessandro.bogliolo@uniurb.it
Floating point encoding
s0.MbseE
(40)(10)
5 4 3 2 1 0 -1
1 0 1 0 0 0 . 0
6 positions
1 0 1 0 1 1 00 0
Example: m=4, e=3
s M se E
(-19)(10)
5 4 3 2 1 0 -1
0 1 0 0 1 1 . 0
5 positions
1 0 0 1 1 0 11 0
s M se E
(0.1)(10)
3 positions
1 1 0 0 0 1 10 1
s M se E-1 -2 -3 -4 -5 -6 -7 -8
. 0 0 0 1 1 0 0 1 ...
40
-18
0.09375
Carc 02.02
alessandro.bogliolo@uniurb.it
Floating point arithmetic
AAEse
AA M.sA 20 BBEse
BB M.sB 20
BBAA Ese
BB
Ese
AA M.sM.sBAC 2020 
AA
AA
BB
Ese
Ese
Ese
BBAA M.sM.s 2
2
2
00 






  AABBAA Ese)EseEse(
BBAA M.sM.s 2200 

BBAA Ese
BB
Ese
AA M.sM.sBAC 2020 
  BBAA EseEse
BBAA M.sM.s 2200 
   BBAA EseEse
BBAA M.sM.s 
 200
Carc 02.02
alessandro.bogliolo@uniurb.it
Floating point arithmetic
s0.MbseE
A = 3.5 = +0.111*2+2
B = 1.5 = +0.110*2+1
E
A . 1 1 1 2
B . 1 1 0 1
A . 1 1 1 2
B . 0 1 1 2
C 1 . 0 1 0 2
C . 1 0 1 3
M
C = A+B = 5 = +0.101*2+3
A = 3.5 = +0.111*2+2
B = 1.5 = +0.110*2+1
C = A*B = 5.25 = +0.10101*2+3
E
A . 1 1 1 2
B . 1 1 0 1
C . 1 0 1 0 1 3
C . 1 0 1 3
M
5
Carc 02.02
alessandro.bogliolo@uniurb.it
IEEE 754
biasExpE
M Es

 2.1)1(
Exp M Meaning
0 0 0
255 0 Infinity
255 non zero NaN
Conventional assumptions binary32
Name Common name Bits s M Exp Emin Emax Bias
binary16 Half precision 16 1 10 5 -14 15 15
binary32 Single precision 32 1 23 8 -126 127 127
binary64 Double precision 64 1 52 11 -1022 1023 1023
binary128 Quadruple precision 128 1 112 15 -16382 16383 16383
Bits

More Related Content

What's hot

Visual basic coding
Visual basic codingVisual basic coding
Visual basic codingSara Corpuz
 
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
 
Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversionkanyuma jitjumnong
 
Number system
Number systemNumber system
Number systemAmit Shaw
 
EFFICIENT MULTIPLIERS FOR 1-OUT-OF-3 BINARY SIGNED-DIGIT NUMBER SYSTEM
EFFICIENT MULTIPLIERS FOR 1-OUT-OF-3 BINARY SIGNED-DIGIT NUMBER SYSTEMEFFICIENT MULTIPLIERS FOR 1-OUT-OF-3 BINARY SIGNED-DIGIT NUMBER SYSTEM
EFFICIENT MULTIPLIERS FOR 1-OUT-OF-3 BINARY SIGNED-DIGIT NUMBER SYSTEMelelijjournal
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number systemNallapati Anindra
 
Unsigned and Signed fixed point Addition and subtraction
Unsigned and Signed  fixed point Addition and subtractionUnsigned and Signed  fixed point Addition and subtraction
Unsigned and Signed fixed point Addition and subtractionciyamala kushbu
 
B sc cs i bo-de u-i number system
B sc cs i bo-de u-i number systemB sc cs i bo-de u-i number system
B sc cs i bo-de u-i number systemRai University
 
Ch1.number systems
Ch1.number systemsCh1.number systems
Ch1.number systemsteba
 
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...Arti Parab Academics
 
Binary parallel adder, decimal adder
Binary parallel adder, decimal adderBinary parallel adder, decimal adder
Binary parallel adder, decimal addershahzad ali
 

What's hot (20)

Visual basic coding
Visual basic codingVisual basic coding
Visual basic coding
 
Number systems r002
Number systems  r002Number systems  r002
Number systems r002
 
Digital logic design part1
Digital logic design part1Digital logic design part1
Digital logic design part1
 
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
 
Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversion
 
Number system
Number systemNumber system
Number system
 
Digital Design Session 2
Digital Design Session 2Digital Design Session 2
Digital Design Session 2
 
EFFICIENT MULTIPLIERS FOR 1-OUT-OF-3 BINARY SIGNED-DIGIT NUMBER SYSTEM
EFFICIENT MULTIPLIERS FOR 1-OUT-OF-3 BINARY SIGNED-DIGIT NUMBER SYSTEMEFFICIENT MULTIPLIERS FOR 1-OUT-OF-3 BINARY SIGNED-DIGIT NUMBER SYSTEM
EFFICIENT MULTIPLIERS FOR 1-OUT-OF-3 BINARY SIGNED-DIGIT NUMBER SYSTEM
 
Basics of digital electronics
Basics of digital electronicsBasics of digital electronics
Basics of digital electronics
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number system
 
Number system
Number systemNumber system
Number system
 
Digital Design Session 1
Digital Design Session 1Digital Design Session 1
Digital Design Session 1
 
Unsigned and Signed fixed point Addition and subtraction
Unsigned and Signed  fixed point Addition and subtractionUnsigned and Signed  fixed point Addition and subtraction
Unsigned and Signed fixed point Addition and subtraction
 
B sc cs i bo-de u-i number system
B sc cs i bo-de u-i number systemB sc cs i bo-de u-i number system
B sc cs i bo-de u-i number system
 
Number systems ppt
Number systems pptNumber systems ppt
Number systems ppt
 
Ch1.number systems
Ch1.number systemsCh1.number systems
Ch1.number systems
 
Digital Logic
Digital LogicDigital Logic
Digital Logic
 
Objective Questions Digital Electronics
Objective Questions Digital ElectronicsObjective Questions Digital Electronics
Objective Questions Digital Electronics
 
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
 
Binary parallel adder, decimal adder
Binary parallel adder, decimal adderBinary parallel adder, decimal adder
Binary parallel adder, decimal adder
 

Viewers also liked

CArcMOOC 01.02 - Brief history of computing
CArcMOOC 01.02 - Brief history of computingCArcMOOC 01.02 - Brief history of computing
CArcMOOC 01.02 - Brief history of computingAlessandro Bogliolo
 
CArcMOOC 03.02 - Switching networks and combinational circuits
CArcMOOC 03.02 - Switching networks and combinational circuitsCArcMOOC 03.02 - Switching networks and combinational circuits
CArcMOOC 03.02 - Switching networks and combinational circuitsAlessandro Bogliolo
 
CArcMOOC 03.01 - Boolean algebra and Logic Synthesis
CArcMOOC 03.01 - Boolean algebra and Logic SynthesisCArcMOOC 03.01 - Boolean algebra and Logic Synthesis
CArcMOOC 03.01 - Boolean algebra and Logic SynthesisAlessandro Bogliolo
 
Paradigm shift: from the bitcoin Blockchain to Networked Computing
Paradigm shift: from the bitcoin Blockchain to Networked ComputingParadigm shift: from the bitcoin Blockchain to Networked Computing
Paradigm shift: from the bitcoin Blockchain to Networked Computingkumar641
 
Beyond the Desktop: Sites and Apps for Phones and Tablets
Beyond the Desktop: Sites and Apps for Phones and TabletsBeyond the Desktop: Sites and Apps for Phones and Tablets
Beyond the Desktop: Sites and Apps for Phones and TabletsWebvanta
 
Brief history of computing
Brief history of computingBrief history of computing
Brief history of computingWebvanta
 
CArcMOOC 01.01 - Automated information processing
CArcMOOC 01.01 - Automated information processingCArcMOOC 01.01 - Automated information processing
CArcMOOC 01.01 - Automated information processingAlessandro Bogliolo
 
Timeline of Computing History
Timeline of Computing HistoryTimeline of Computing History
Timeline of Computing HistoryOERindia
 
Computing History Part 1
Computing History  Part 1Computing History  Part 1
Computing History Part 1Ritesh Nayak
 
CArcMOOC 03.04 - Gate-level design
CArcMOOC 03.04 - Gate-level designCArcMOOC 03.04 - Gate-level design
CArcMOOC 03.04 - Gate-level designAlessandro Bogliolo
 
A brief history of computing
A brief history of computingA brief history of computing
A brief history of computingvoxace
 
1 history of information technology
1 history of information technology1 history of information technology
1 history of information technologyMuhammed Shafi Mk
 
CArcMOOC 05.03 - Pipeline hazards
CArcMOOC 05.03 - Pipeline hazardsCArcMOOC 05.03 - Pipeline hazards
CArcMOOC 05.03 - Pipeline hazardsAlessandro Bogliolo
 

Viewers also liked (15)

CArcMOOC 01.02 - Brief history of computing
CArcMOOC 01.02 - Brief history of computingCArcMOOC 01.02 - Brief history of computing
CArcMOOC 01.02 - Brief history of computing
 
CArcMOOC 03.02 - Switching networks and combinational circuits
CArcMOOC 03.02 - Switching networks and combinational circuitsCArcMOOC 03.02 - Switching networks and combinational circuits
CArcMOOC 03.02 - Switching networks and combinational circuits
 
CArcMOOC 03.01 - Boolean algebra and Logic Synthesis
CArcMOOC 03.01 - Boolean algebra and Logic SynthesisCArcMOOC 03.01 - Boolean algebra and Logic Synthesis
CArcMOOC 03.01 - Boolean algebra and Logic Synthesis
 
Paradigm shift: from the bitcoin Blockchain to Networked Computing
Paradigm shift: from the bitcoin Blockchain to Networked ComputingParadigm shift: from the bitcoin Blockchain to Networked Computing
Paradigm shift: from the bitcoin Blockchain to Networked Computing
 
Beyond the Desktop: Sites and Apps for Phones and Tablets
Beyond the Desktop: Sites and Apps for Phones and TabletsBeyond the Desktop: Sites and Apps for Phones and Tablets
Beyond the Desktop: Sites and Apps for Phones and Tablets
 
Brief history of computing
Brief history of computingBrief history of computing
Brief history of computing
 
CArcMOOC 01.01 - Automated information processing
CArcMOOC 01.01 - Automated information processingCArcMOOC 01.01 - Automated information processing
CArcMOOC 01.01 - Automated information processing
 
Timeline of Computing History
Timeline of Computing HistoryTimeline of Computing History
Timeline of Computing History
 
CArcMOOC 03.05 - RTL design
CArcMOOC 03.05 - RTL designCArcMOOC 03.05 - RTL design
CArcMOOC 03.05 - RTL design
 
Computing History Part 1
Computing History  Part 1Computing History  Part 1
Computing History Part 1
 
CArcMOOC 03.04 - Gate-level design
CArcMOOC 03.04 - Gate-level designCArcMOOC 03.04 - Gate-level design
CArcMOOC 03.04 - Gate-level design
 
A brief history of computing
A brief history of computingA brief history of computing
A brief history of computing
 
CodyQuiz live per CodeWeek 2016
CodyQuiz live per CodeWeek 2016CodyQuiz live per CodeWeek 2016
CodyQuiz live per CodeWeek 2016
 
1 history of information technology
1 history of information technology1 history of information technology
1 history of information technology
 
CArcMOOC 05.03 - Pipeline hazards
CArcMOOC 05.03 - Pipeline hazardsCArcMOOC 05.03 - Pipeline hazards
CArcMOOC 05.03 - Pipeline hazards
 

Similar to CArcMOOC 02.02 - Encodings of numerical sets

Number System 123.ppt is for binary number system
Number System 123.ppt is for binary number systemNumber System 123.ppt is for binary number system
Number System 123.ppt is for binary number systemdrpreetiwctm
 
Number system and codes
Number system and codesNumber system and codes
Number system and codesAbhiraj Bohra
 
Story of Number.ppt
Story of Number.pptStory of Number.ppt
Story of Number.pptshivas379526
 
Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009lionking
 
unit-i-number-systems.pdf
unit-i-number-systems.pdfunit-i-number-systems.pdf
unit-i-number-systems.pdfRameshK531901
 
Digital Logic Design.pptx
Digital Logic Design.pptxDigital Logic Design.pptx
Digital Logic Design.pptxAminaZahid16
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptskatiarrahaman
 
Chapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSIChapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSIEr. Nawaraj Bhandari
 
Ncp computer appls num sys2 pramod
Ncp computer appls  num sys2 pramodNcp computer appls  num sys2 pramod
Ncp computer appls num sys2 pramodNCP
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in indiaEdhole.com
 
Ee2 chapter1 number_system
Ee2 chapter1 number_systemEe2 chapter1 number_system
Ee2 chapter1 number_systemCK Yang
 
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
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptRAJKUMARP63
 

Similar to CArcMOOC 02.02 - Encodings of numerical sets (20)

Number System 123.ppt is for binary number system
Number System 123.ppt is for binary number systemNumber System 123.ppt is for binary number system
Number System 123.ppt is for binary number system
 
Bolum1cozumler
Bolum1cozumlerBolum1cozumler
Bolum1cozumler
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
 
DESIGN OF COMBINATIONAL LOGIC
DESIGN OF COMBINATIONAL LOGICDESIGN OF COMBINATIONAL LOGIC
DESIGN OF COMBINATIONAL LOGIC
 
Story of Number.ppt
Story of Number.pptStory of Number.ppt
Story of Number.ppt
 
Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009
 
unit-i-number-systems.pdf
unit-i-number-systems.pdfunit-i-number-systems.pdf
unit-i-number-systems.pdf
 
Digital Logic Design.pptx
Digital Logic Design.pptxDigital Logic Design.pptx
Digital Logic Design.pptx
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.ppt
 
Chapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSIChapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSI
 
L2 number
L2 numberL2 number
L2 number
 
1
11
1
 
Ncp computer appls num sys2 pramod
Ncp computer appls  num sys2 pramodNcp computer appls  num sys2 pramod
Ncp computer appls num sys2 pramod
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Ee2 chapter1 number_system
Ee2 chapter1 number_systemEe2 chapter1 number_system
Ee2 chapter1 number_system
 
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
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 

More from Alessandro Bogliolo

BIBMOOC 05.03 - Codici in biblioteca
BIBMOOC 05.03 - Codici in bibliotecaBIBMOOC 05.03 - Codici in biblioteca
BIBMOOC 05.03 - Codici in bibliotecaAlessandro Bogliolo
 
BIBMOOC 06.02 - Buone pratiche: Il caso di Settimo Torinese - Lisa Marcenaro ...
BIBMOOC 06.02 - Buone pratiche: Il caso di Settimo Torinese - Lisa Marcenaro ...BIBMOOC 06.02 - Buone pratiche: Il caso di Settimo Torinese - Lisa Marcenaro ...
BIBMOOC 06.02 - Buone pratiche: Il caso di Settimo Torinese - Lisa Marcenaro ...Alessandro Bogliolo
 
BIBMOOC 5.2 - Algoritmi in biblioteca
BIBMOOC 5.2 - Algoritmi in bibliotecaBIBMOOC 5.2 - Algoritmi in biblioteca
BIBMOOC 5.2 - Algoritmi in bibliotecaAlessandro Bogliolo
 
BIBMOOC 05.01 - Installazioni di coding e gamification
BIBMOOC 05.01 - Installazioni di coding e gamificationBIBMOOC 05.01 - Installazioni di coding e gamification
BIBMOOC 05.01 - Installazioni di coding e gamificationAlessandro Bogliolo
 
BIBMOOC 06.01 - Buone pratiche: il caso di CSBNO - Giovanni Mojoli
BIBMOOC 06.01 - Buone pratiche: il caso di CSBNO - Giovanni MojoliBIBMOOC 06.01 - Buone pratiche: il caso di CSBNO - Giovanni Mojoli
BIBMOOC 06.01 - Buone pratiche: il caso di CSBNO - Giovanni MojoliAlessandro Bogliolo
 
BIBMOOC 04.04 - Progettualità e opportunità di finanziamento - Simona Villa
BIBMOOC 04.04 - Progettualità e opportunità di finanziamento - Simona VillaBIBMOOC 04.04 - Progettualità e opportunità di finanziamento - Simona Villa
BIBMOOC 04.04 - Progettualità e opportunità di finanziamento - Simona VillaAlessandro Bogliolo
 
BIBMOOC 04.03 - Progettare spazi per la cultura - Marco Muscogiuri
BIBMOOC 04.03 - Progettare spazi per la cultura - Marco MuscogiuriBIBMOOC 04.03 - Progettare spazi per la cultura - Marco Muscogiuri
BIBMOOC 04.03 - Progettare spazi per la cultura - Marco MuscogiuriAlessandro Bogliolo
 
BIBMOOC 04.02 - Marketing culturale - Anna Busa
BIBMOOC 04.02 - Marketing culturale - Anna BusaBIBMOOC 04.02 - Marketing culturale - Anna Busa
BIBMOOC 04.02 - Marketing culturale - Anna BusaAlessandro Bogliolo
 
BIBMOOC 3.2 - Coding unplugged fai-da-te
BIBMOOC 3.2 - Coding unplugged fai-da-teBIBMOOC 3.2 - Coding unplugged fai-da-te
BIBMOOC 3.2 - Coding unplugged fai-da-teAlessandro Bogliolo
 
BIBMOOC 03.01 - Programmazione visuale a blocchi
BIBMOOC 03.01 - Programmazione visuale a blocchiBIBMOOC 03.01 - Programmazione visuale a blocchi
BIBMOOC 03.01 - Programmazione visuale a blocchiAlessandro Bogliolo
 
BIBMOOC 02.01 - Esecutore ideale e istruzioni elementari
BIBMOOC 02.01 - Esecutore ideale e istruzioni elementariBIBMOOC 02.01 - Esecutore ideale e istruzioni elementari
BIBMOOC 02.01 - Esecutore ideale e istruzioni elementariAlessandro Bogliolo
 
BIBMOOC 02.02 - Sequenze di istruzioni ripetizione e condizioni
BIBMOOC 02.02 - Sequenze di istruzioni ripetizione e condizioniBIBMOOC 02.02 - Sequenze di istruzioni ripetizione e condizioni
BIBMOOC 02.02 - Sequenze di istruzioni ripetizione e condizioniAlessandro Bogliolo
 
BIBMOOC 01.03 - Le biblioteche e la loro funzione sociale - Chiara Faggiolani
BIBMOOC 01.03 - Le biblioteche e la loro funzione sociale - Chiara FaggiolaniBIBMOOC 01.03 - Le biblioteche e la loro funzione sociale - Chiara Faggiolani
BIBMOOC 01.03 - Le biblioteche e la loro funzione sociale - Chiara FaggiolaniAlessandro Bogliolo
 
BIBMOOC 1.2 - Coding e pensiero computazionale
BIBMOOC 1.2 - Coding e pensiero computazionaleBIBMOOC 1.2 - Coding e pensiero computazionale
BIBMOOC 1.2 - Coding e pensiero computazionaleAlessandro Bogliolo
 
BIBMOOC 1.1 - Informazione e rappresentazioni digitali
BIBMOOC 1.1 - Informazione e rappresentazioni digitaliBIBMOOC 1.1 - Informazione e rappresentazioni digitali
BIBMOOC 1.1 - Informazione e rappresentazioni digitaliAlessandro Bogliolo
 
AIMOOC 7.3 - Per una IA etica - Claudia Chiavarino
AIMOOC 7.3 - Per una IA etica - Claudia ChiavarinoAIMOOC 7.3 - Per una IA etica - Claudia Chiavarino
AIMOOC 7.3 - Per una IA etica - Claudia ChiavarinoAlessandro Bogliolo
 
AIMOOC 7.2 - La strategia europea per l'I.A. - Lucilla Sioli
AIMOOC 7.2 - La strategia europea per l'I.A. - Lucilla SioliAIMOOC 7.2 - La strategia europea per l'I.A. - Lucilla Sioli
AIMOOC 7.2 - La strategia europea per l'I.A. - Lucilla SioliAlessandro Bogliolo
 
AIMOOC 5.5 - Programmazione o addestramento? - Alessandro Bogliolo
AIMOOC 5.5 - Programmazione o addestramento? - Alessandro BoglioloAIMOOC 5.5 - Programmazione o addestramento? - Alessandro Bogliolo
AIMOOC 5.5 - Programmazione o addestramento? - Alessandro BoglioloAlessandro Bogliolo
 

More from Alessandro Bogliolo (20)

BIBMOOC 05.03 - Codici in biblioteca
BIBMOOC 05.03 - Codici in bibliotecaBIBMOOC 05.03 - Codici in biblioteca
BIBMOOC 05.03 - Codici in biblioteca
 
BIBMOOC 06.02 - Buone pratiche: Il caso di Settimo Torinese - Lisa Marcenaro ...
BIBMOOC 06.02 - Buone pratiche: Il caso di Settimo Torinese - Lisa Marcenaro ...BIBMOOC 06.02 - Buone pratiche: Il caso di Settimo Torinese - Lisa Marcenaro ...
BIBMOOC 06.02 - Buone pratiche: Il caso di Settimo Torinese - Lisa Marcenaro ...
 
BIBMOOC 5.2 - Algoritmi in biblioteca
BIBMOOC 5.2 - Algoritmi in bibliotecaBIBMOOC 5.2 - Algoritmi in biblioteca
BIBMOOC 5.2 - Algoritmi in biblioteca
 
BIBMOOC 05.01 - Installazioni di coding e gamification
BIBMOOC 05.01 - Installazioni di coding e gamificationBIBMOOC 05.01 - Installazioni di coding e gamification
BIBMOOC 05.01 - Installazioni di coding e gamification
 
BIBMOOC 06.01 - Buone pratiche: il caso di CSBNO - Giovanni Mojoli
BIBMOOC 06.01 - Buone pratiche: il caso di CSBNO - Giovanni MojoliBIBMOOC 06.01 - Buone pratiche: il caso di CSBNO - Giovanni Mojoli
BIBMOOC 06.01 - Buone pratiche: il caso di CSBNO - Giovanni Mojoli
 
Nuovi LIDI - Lezione 1
Nuovi LIDI - Lezione 1Nuovi LIDI - Lezione 1
Nuovi LIDI - Lezione 1
 
BIBMOOC 04.04 - Progettualità e opportunità di finanziamento - Simona Villa
BIBMOOC 04.04 - Progettualità e opportunità di finanziamento - Simona VillaBIBMOOC 04.04 - Progettualità e opportunità di finanziamento - Simona Villa
BIBMOOC 04.04 - Progettualità e opportunità di finanziamento - Simona Villa
 
BIBMOOC 04.03 - Progettare spazi per la cultura - Marco Muscogiuri
BIBMOOC 04.03 - Progettare spazi per la cultura - Marco MuscogiuriBIBMOOC 04.03 - Progettare spazi per la cultura - Marco Muscogiuri
BIBMOOC 04.03 - Progettare spazi per la cultura - Marco Muscogiuri
 
BIBMOOC 04.02 - Marketing culturale - Anna Busa
BIBMOOC 04.02 - Marketing culturale - Anna BusaBIBMOOC 04.02 - Marketing culturale - Anna Busa
BIBMOOC 04.02 - Marketing culturale - Anna Busa
 
BIBMOOC 3.2 - Coding unplugged fai-da-te
BIBMOOC 3.2 - Coding unplugged fai-da-teBIBMOOC 3.2 - Coding unplugged fai-da-te
BIBMOOC 3.2 - Coding unplugged fai-da-te
 
BIBMOOC 03.01 - Programmazione visuale a blocchi
BIBMOOC 03.01 - Programmazione visuale a blocchiBIBMOOC 03.01 - Programmazione visuale a blocchi
BIBMOOC 03.01 - Programmazione visuale a blocchi
 
BIBMOOC 02.01 - Esecutore ideale e istruzioni elementari
BIBMOOC 02.01 - Esecutore ideale e istruzioni elementariBIBMOOC 02.01 - Esecutore ideale e istruzioni elementari
BIBMOOC 02.01 - Esecutore ideale e istruzioni elementari
 
BIBMOOC 02.02 - Sequenze di istruzioni ripetizione e condizioni
BIBMOOC 02.02 - Sequenze di istruzioni ripetizione e condizioniBIBMOOC 02.02 - Sequenze di istruzioni ripetizione e condizioni
BIBMOOC 02.02 - Sequenze di istruzioni ripetizione e condizioni
 
BIBMOOC 01.03 - Le biblioteche e la loro funzione sociale - Chiara Faggiolani
BIBMOOC 01.03 - Le biblioteche e la loro funzione sociale - Chiara FaggiolaniBIBMOOC 01.03 - Le biblioteche e la loro funzione sociale - Chiara Faggiolani
BIBMOOC 01.03 - Le biblioteche e la loro funzione sociale - Chiara Faggiolani
 
BIBMOOC 1.2 - Coding e pensiero computazionale
BIBMOOC 1.2 - Coding e pensiero computazionaleBIBMOOC 1.2 - Coding e pensiero computazionale
BIBMOOC 1.2 - Coding e pensiero computazionale
 
BIBMOOC 1.1 - Informazione e rappresentazioni digitali
BIBMOOC 1.1 - Informazione e rappresentazioni digitaliBIBMOOC 1.1 - Informazione e rappresentazioni digitali
BIBMOOC 1.1 - Informazione e rappresentazioni digitali
 
CodyTrip a BTO2021
CodyTrip a BTO2021CodyTrip a BTO2021
CodyTrip a BTO2021
 
AIMOOC 7.3 - Per una IA etica - Claudia Chiavarino
AIMOOC 7.3 - Per una IA etica - Claudia ChiavarinoAIMOOC 7.3 - Per una IA etica - Claudia Chiavarino
AIMOOC 7.3 - Per una IA etica - Claudia Chiavarino
 
AIMOOC 7.2 - La strategia europea per l'I.A. - Lucilla Sioli
AIMOOC 7.2 - La strategia europea per l'I.A. - Lucilla SioliAIMOOC 7.2 - La strategia europea per l'I.A. - Lucilla Sioli
AIMOOC 7.2 - La strategia europea per l'I.A. - Lucilla Sioli
 
AIMOOC 5.5 - Programmazione o addestramento? - Alessandro Bogliolo
AIMOOC 5.5 - Programmazione o addestramento? - Alessandro BoglioloAIMOOC 5.5 - Programmazione o addestramento? - Alessandro Bogliolo
AIMOOC 5.5 - Programmazione o addestramento? - Alessandro Bogliolo
 

Recently uploaded

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 

Recently uploaded (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 

CArcMOOC 02.02 - Encodings of numerical sets

  • 1. Carc 02.02 alessandro.bogliolo@uniurb.it 02. Binary representations 02.02. Numerical sets and binary arithmetic • Positional notation • Unsigned integers • Unsigned fixed-point • Signed numbers • Floating point numbers • Base conversions • Binary arithmetic Computer Architecture alessandro.bogliolo@uniurb.it
  • 2. Carc 02.02 alessandro.bogliolo@uniurb.it Positional notation of unsigned integers 0 0 1 1 2 2 1 1 ... bcbcbcbc n n n n      0121 ... cccc nn  • The base-b positional representation of an integer number of n digits has the form • The value of the number is • n digits encode all integer numbers from 0 to bn-1 Example: b=2, n=5 10011=1*16+1*2+1*1=19 11111=31=25-1 (1) (2)
  • 3. Carc 02.02 alessandro.bogliolo@uniurb.it Base conversion 0 0 1 1 2 2 1 1 ... bcbcbcbc n n n n      • From base b to decimal: • From decimal to base b: digits from c0 to cn-1 are obtained as remainders of subsequent divisions by b of the digital number 0 0 1 3 2 2 1 0 0 1 1 2 2 1 1 cb)bc...bcbc( bcbc...bcbc n n n n n n n n           (2) (3)
  • 4. Carc 02.02 alessandro.bogliolo@uniurb.it Base conversion example (29)(10)=(11101)(2) (11001)(2)=(25)(10) 29 29 14 1 29=14*2+1 14 7 0 14=7*2+0 7 3 1 7=3*2+1 3 1 1 3=1*2+1 1 0 1 1=0*2+1 position digit weight 0 1 1 1 + 1 0 2 0 + 2 0 4 0 + 3 1 8 8 + 4 1 16 16 25
  • 5. Carc 02.02 alessandro.bogliolo@uniurb.it Fixed-point notation of unsigned rational numbers m m n n n n bc...bcbcbc...bcbc          1 1 0 0 1 1 2 2 1 1 mnn c...c.cc...cc  10121 • The base-b positional representation of a rational number of n+m digits has the form • The value of the number is • n+m digits encode all rational numbers of the form m Num 2 with 120  mn Num (4) (5) (6)
  • 6. Carc 02.02 alessandro.bogliolo@uniurb.it Base conversion • From base b to decimal: • From decimal to base b: – Solution 1: Given a digital number X=Num/2m, convert Num and shift the decimal point m positions left – Solution 2: Given a digital number X=Xint.Xfrac, convert the integer part Xint as outlined before, then convert the fractional part Xfrac obtaining each digit as the integer part of the result of subsequent multiplications by b: m m n n n n bc...bcbcbc...bcbc          1 1 0 0 1 1 2 2 1 1 11 21 2 2 1 1            m m m m bc...bccb)bc...bcbc( (7) (5)
  • 7. Carc 02.02 alessandro.bogliolo@uniurb.it Base conversion example (29.375)(10)=(11101.011)(2) 29 29 14 1 29=14*2+1 14 7 0 14=7*2+0 7 3 1 7=3*2+1 3 1 1 3=1*2+1 1 0 1 1=0*2+1 0.375 *2 = 0.75 = 0 + 0.75 0.75 *2 = 1.5 = 1 + 0.5 0.5 *2 = 1 = 1 + 0
  • 8. Carc 02.02 alessandro.bogliolo@uniurb.it Binary arithmetic • Binary addition: • Binary multiplication: 0 1 0 0 1 1 1 10 1 1 1 1 1 5 0 1 1 1 1 6 0 0 1 1 0 2 1 1 0 1 0 1 0 1 0 0 0 1 0 1 1 2 1 5 6 0 1 2 - 1 8 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 0 - 1 1 0 0 - - 1 1 0 0 - - - 1 0 1 1 0 1 0 0
  • 9. Carc 02.02 alessandro.bogliolo@uniurb.it Signed numbers • Sign bit: 0=positive, 1=negative (3)(10) = 0 0011; (-3)(10) = 1 0011 • 1’s complement (3)(10) = 0 0011; (-3)(10) = 1 1100 = (0 0011)’ • 2’s complement (3)(10) = 0 0011; (-3)(10) = 1 1101 = (0 0011)’+1
  • 10. Carc 02.02 alessandro.bogliolo@uniurb.it 2’s complement numbers • The 2’s complement representation of a negative number (say, -v) is obtained from the representation of v, by complementing each bit (including the sign bit) and adding 1 -vv’+1 • The resulting binary configuration corresponds to the unsigned number 2n-v (i.e., the complement of v to 2n), where n is the total number of digits, including the sign bit. 0 2n v-v 2n-v positive negative
  • 11. Carc 02.02 alessandro.bogliolo@uniurb.it 2’s complement arithmetic • 2’s complement numbers can be added by using the conventional rules of binary addition a+(-b)  a+(2n-b)=2n-(b-a)-(b-a)=a-b • Example: (3)(10)-(5)(10) (00011)(2)-(00101)(2) = (00011)(2)+(-00101)(2) (00011)(2c)+(11011)(2c) = (11110)(2c) (-00010)(2) (-2)(10)
  • 12. Carc 02.02 alessandro.bogliolo@uniurb.it Floating point numbers • s = sign (1 bit) • M = Mantissa (m bits) • b = base (0 bits) • se = exponent sign (1 bit) • E = exponent (e bits) Encoding floating point numbers requires words of n digits, with n=1+m+1+e s0.MbseE
  • 13. Carc 02.02 alessandro.bogliolo@uniurb.it Floating point encoding 1. Start from a fixed-point binary encoding using a sufficient number of bits 2. Evaluate the number of shifts required to bring the most significant 1 in position –1 3. Take as mantissa (M) the most significant m bits (starting from the first 1) of the fixed-point encoding 4. Set se=1 if the number is lower than 0.5, se=0 otherwise 5. Assign the exponent E with the binary representation of the number of shifts computed at step 2 6. Set the sign bit s as usual s0.MbseE
  • 14. Carc 02.02 alessandro.bogliolo@uniurb.it Floating point encoding s0.MbseE (40)(10) 5 4 3 2 1 0 -1 1 0 1 0 0 0 . 0 6 positions 1 0 1 0 1 1 00 0 Example: m=4, e=3 s M se E (-19)(10) 5 4 3 2 1 0 -1 0 1 0 0 1 1 . 0 5 positions 1 0 0 1 1 0 11 0 s M se E (0.1)(10) 3 positions 1 1 0 0 0 1 10 1 s M se E-1 -2 -3 -4 -5 -6 -7 -8 . 0 0 0 1 1 0 0 1 ... 40 -18 0.09375
  • 15. Carc 02.02 alessandro.bogliolo@uniurb.it Floating point arithmetic AAEse AA M.sA 20 BBEse BB M.sB 20 BBAA Ese BB Ese AA M.sM.sBAC 2020  AA AA BB Ese Ese Ese BBAA M.sM.s 2 2 2 00          AABBAA Ese)EseEse( BBAA M.sM.s 2200   BBAA Ese BB Ese AA M.sM.sBAC 2020    BBAA EseEse BBAA M.sM.s 2200     BBAA EseEse BBAA M.sM.s   200
  • 16. Carc 02.02 alessandro.bogliolo@uniurb.it Floating point arithmetic s0.MbseE A = 3.5 = +0.111*2+2 B = 1.5 = +0.110*2+1 E A . 1 1 1 2 B . 1 1 0 1 A . 1 1 1 2 B . 0 1 1 2 C 1 . 0 1 0 2 C . 1 0 1 3 M C = A+B = 5 = +0.101*2+3 A = 3.5 = +0.111*2+2 B = 1.5 = +0.110*2+1 C = A*B = 5.25 = +0.10101*2+3 E A . 1 1 1 2 B . 1 1 0 1 C . 1 0 1 0 1 3 C . 1 0 1 3 M 5
  • 17. Carc 02.02 alessandro.bogliolo@uniurb.it IEEE 754 biasExpE M Es   2.1)1( Exp M Meaning 0 0 0 255 0 Infinity 255 non zero NaN Conventional assumptions binary32 Name Common name Bits s M Exp Emin Emax Bias binary16 Half precision 16 1 10 5 -14 15 15 binary32 Single precision 32 1 23 8 -126 127 127 binary64 Double precision 64 1 52 11 -1022 1023 1023 binary128 Quadruple precision 128 1 112 15 -16382 16383 16383 Bits