Conversion of Binary, Octal and
Hexadecimal Numbers
From Binary to Octal
Starting at the binary point and working left, separate the bits into
groups of three and replace each group with the corresponding octal
digit.
100010112 = 010 001 011 = 2138
From Binary to Hexadecimal
Starting at the binary point and working left, separate the bits into
groups of four and replace each group with the corresponding
hexadecimal digit.
100010112 = 1000 1011 = 8B16
From Octal to Binary
Replace each octal digit with the corresponding 3-bit binary string.
2138 = 010 001 011 = 100010112
From Hexadecimal to Binary
Replace each hexadecimal digit with the corresponding 4-bit binary
string.
8B16 = 1000 1011 = 100010112
Conversion of Decimal Numbers
From Decimal to Binary
17 12
34 02
69 12
139 12
8 02
4 02
2 02
1 MSD
LSD
From Binary to Decimal
100010112
= 1×27
+ 0×26
+ 0×25
+ 0×24
+ 1×23
+ 0×22
+ 1×21
+ 1×20
= 128 + 8 + 2 + 1
13910 = 100010112
Conversion of Fractions
Starting at the binary point, group the binary digits that lie to
the right into groups of three or four.
0.101112 = 0.101 110 = 0.568
0.101112 = 0.1011 1000 = 0.B816
Problems Convert the following
Binary Octal Decimal Hex
10011010
2705
2705
3BC
Binary Octal Decimal Hex
10011010 232 154 9A
10111000101 2705 1477 5C5
101010010001 5221 2705 A91
1110111100 1674 956 3BC
5
42 28
338 28
2705 18
10=A
169 916
2705 116
Add
1 1 1 1 1 0 0 1 1
+ 1 0 0 1 + 1 1 1 0
1 1 0 0 0 1 0 0 0 0 1
Subtract
1 1 0 0 0 1 0 0 1 1
- 1 1 1 1 - 1 1 1 1
1 0 0 1 1 0 0
Multiply
normally for implementation - add the shifted
multiplicands one at a time.
1 1 1 0 = 14 1 1 1 0
* 1 1 0 1 = 13 * 1 1 0 1
1 1 1 0 1 1 1 0
0 0 0 0 + 0 0 0 0
1 1 1 0 0 1 1 1 0
+ 1 1 1 0 + 1 1 1 0
1 0 1 1 0 1 1 0 1 0 0 0 1 1 0
+ 1 1 1 0
1 0 1 1 0 1 1 0 (8 bits)
Divide
1 1 0 1 1 1 0
1 1 1 1 ) 1 1 0 0 0 1 0 1 | 1 1 0 1 ) 1 0 1 1 0 0 1 |
1 1 1 1 | 1 1 0 1 |
1 0 0 1 1 0 1 | 1 0 0 1 0 1 |
1 1 1 1 | 1 1 0 1 |
1 0 0 0 1 | 1 0 1 1 |
0 0 0 0 | 0 0 0 0 |
1 0 0 0 1 | 1 0 1 1
1 1 1 1 |
1 0
1 0 0 1
1 1 0 1 ) 1 1 1 1 0 0 1 |
1 1 0 1 |
1 0 0 0 1 |
0 0 0 0 |
1 0 0 0 1 |
0 0 0 0 |
1 0 0 0 1 |
1 1 0 1 |
1 0 0
Sign-Magnitude
0 = positive
1 = negative
n bit range = -(2n-1
-1) to +(2n-1
-1)
4 bits range = -7 to +7
2 possible representation of zero.
2's Complement
flip bits and add one.
n bit range = -(2n-1
) to +(2n-1
-1)
4 bits range = -8 to +7
0 0 0 0 = 0
0 0 0 1 = 1
0 0 1 0 = 2
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1 = 7
1 0 0 0 = -8
1 0 0 1 = -7
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0 = -2
1 1 1 1 = -1
Example
1 1 1 0 = 14
0 0 0 1 flip bits
0 0 1 0 add one WRONG this is not -14. Out of range. Need 5 bits
0 1 1 1 0 = 14
1 0 0 0 1 flip bits
1 0 0 1 0 add one. This is -14.
Sign Extend
add 0 for positive numbers
add 1 for negative numbers
Add 2's Complement
1 1 1 0 = -2 1 1 1 0 = -2
+ 1 1 0 1 = -3 + 0 0 1 1 = 3
1 1 0 1 1 ignore carry = -5 1 0 0 0 1 ignore carry = 1
Be careful of overflow errors. An addition overflow occurs whenever the sign of the sum if
different from the signs of both operands. Ex.
0 1 0 0 = 4 1 1 0 0 = -4
+ 0 1 0 1 = 5 + 1 0 1 1 = -5
1 0 0 1 = -7 WRONG 1 0 1 1 1 ignore carry = 7 WRONG
Multiply 2's Complement
1 1 1 0 = -2 1 1 1 0 = -2
* 1 1 0 1 = -3 * 0 0 1 1 = 3
1 1 1 1 1 1 1 0 sign extend to 8 bits 1 1 1 1 1 1 1 0 sign extend to 8 bits
+ 0 0 0 0 0 0 0 + 1 1 1 1 1 1 0
1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 0 ignore carry = -6
+ 1 1 1 1 1 0
1 1 1 1 1 0 1 1 0 ignore carry
+ 0 0 0 1 0 negate -2 for sign bit
1 0 0 0 0 0 1 1 0 ignore carry = 6
1 0 0 1 0 = -14
* 1 0 0 1 1 = -13
1 1 1 1 1 1 0 0 1 0 sign extend to 10 bits
+ 1 1 1 1 1 0 0 1 0
1 1 1 1 1 0 1 0 1 1 0 ignore carry
+ 0 0 0 0 0 0 0 0
1 1 1 1 0 1 0 1 1 0
+ 0 0 0 0 0 0 0
1 1 1 1 0 1 0 1 1 0
+ 0 0 1 1 1 0 negate -14 for sign bit
1 0 0 1 0 1 1 0 1 1 0 ignore carry = 182
Floating-Point Numbers
mantissa x (radix)exponent
The floating-point representation always gives us more range and less precision than the
fixed-point representation when using the SAME number of digits.
11-bit excess
1023 charactstic
Mantissa
sign
52-bit normalized fraction
Sign
exponent
Mantissa
sign
Mantissa magnitude
8-bit excess-127
characteristic
Mantissa
sign
23-bit normalized fraction
General format
32-bit standard
64-bit standard
0 1 12 63
31910
Implied binary point
Normalized fraction - the fraction always starts with a nonzero bit. e.g.
0.01 … x 2e
would be normalized to 0.1 … x 2e-1
1.01 … x 2e
would be normalized to 0.101 … x 2e+1
Since the only nonzero bit is 1, it is usually omitted in all computers today. Thus, the 23-bit
normalized fraction in reality has 24 bits.
The exponent is represented in a biased form.
• If we take an m-bit exponent, there are 2m
possible unsigned integer values.
• Re-label these numbers: 0 to 2m
-1 → -2m-1
to 2m-1
-1 by subtracting a constant value (or
bias) of 2m-1
(or sometimes 2m-1
-1).
• Ex. using m=3, the bias = 23-1
= 4. Thus the series 0,1,2,3,4,5,6,7 becomes -4,-3,-2,-
1,0,1,2,3. Therefore, the true exponent -4 is represented by 0 in the bias form and -3 by
+1, etc.
• zero is represented by 0.0 … x 20
.
Ex. if n = 1010.1111, we normalize it to 0.10101111 x 24
. The true exponent is +4. Using the
32-bit standard and a bias of 2m-1
-1 = 28-1
-1 = 127, the true exponent (+4) is stored as a biased
exponent of 4+127 = 131, or 10000011 in binary. Thus we have
0 | 1 0 0 0 0 0 1 1 | 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Notice that the first 1 in the normalized fraction is omitted.
The biased exponent representation is also called excess n, where n is 2m-1
-1 (or 2m-1
).

More Related Content

PPT
Binary number systems multiplication
PPT
Binary operations
PDF
Binary addition
PDF
IEEE Floating Point
PDF
Floating point presentation
PPSX
Number system (Binary Number)
PPT
Binary Arithmetic
PPTX
Binary true ppt
Binary number systems multiplication
Binary operations
Binary addition
IEEE Floating Point
Floating point presentation
Number system (Binary Number)
Binary Arithmetic
Binary true ppt

What's hot (19)

PDF
Digital and Logic Design Chapter 1 binary_systems
PPT
Pertemuan 2 - Sistem Bilangan
PPTX
IEEE floating point representation
PPTX
Number systems - binary, BCD, 2s comp
PPT
Lecture 3
PPTX
Digital logic mohammed salim ch2
PPTX
Binary arithmetic
PDF
Number system
PPSX
Sig figs.ppt
PPT
binary arithmetic rules
PDF
Binaty Arithmetic and Binary coding schemes
PPSX
JobEsteem - chapter 1 - simplification
PPTX
The Big M Method - Operation Research
PPTX
Digital computer fundamentals
PPTX
Introducing to number system
PPTX
Operations Research - The Big M Method
PPT
1sand2scomplement r004
PPTX
Number system
Digital and Logic Design Chapter 1 binary_systems
Pertemuan 2 - Sistem Bilangan
IEEE floating point representation
Number systems - binary, BCD, 2s comp
Lecture 3
Digital logic mohammed salim ch2
Binary arithmetic
Number system
Sig figs.ppt
binary arithmetic rules
Binaty Arithmetic and Binary coding schemes
JobEsteem - chapter 1 - simplification
The Big M Method - Operation Research
Digital computer fundamentals
Introducing to number system
Operations Research - The Big M Method
1sand2scomplement r004
Number system
Ad

Similar to Ncp computer appls num sys1 pramod (20)

PPT
Counit2
PDF
Finite word length effects
PPT
3.Fixed-Floating Point.ppt
PPT
09 arithmetic
PDF
Digital Electronics – Unit I.pdf
PPT
09 arithmetic 2
PPT
09 arithmetic
PDF
Module 2_Data representations.pdf
PPT
chapter 3 000Number_Systems.ppt
PPTX
csc221_lecture_03_datarepresentation_02.pptx
PPTX
Data Representation
PPTX
Data Representation from knowledge center
PPTX
Unit 2 Arithmetic
PPT
Logic Design - Chapter 1: Number Systems and Codes
PPTX
Data Reprersentation
PPTX
ARITHMETIC FOR COMPUTERS
PPT
100_2_digitalSystem_Chap1 (2).ppt
PDF
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
PPTX
Computer Representation of Numbers and.pptx
PPTX
Computer Oraganizaation.pptx
Counit2
Finite word length effects
3.Fixed-Floating Point.ppt
09 arithmetic
Digital Electronics – Unit I.pdf
09 arithmetic 2
09 arithmetic
Module 2_Data representations.pdf
chapter 3 000Number_Systems.ppt
csc221_lecture_03_datarepresentation_02.pptx
Data Representation
Data Representation from knowledge center
Unit 2 Arithmetic
Logic Design - Chapter 1: Number Systems and Codes
Data Reprersentation
ARITHMETIC FOR COMPUTERS
100_2_digitalSystem_Chap1 (2).ppt
CS304PC:Computer Organization and Architecture Unit- III PDF notes .pdf
Computer Representation of Numbers and.pptx
Computer Oraganizaation.pptx
Ad

Recently uploaded (20)

PDF
Empowerment Technology for Senior High School Guide
PDF
My India Quiz Book_20210205121199924.pdf
PDF
IGGE1 Understanding the Self1234567891011
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
advance database management system book.pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
Virtual and Augmented Reality in Current Scenario
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Trump Administration's workforce development strategy
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Computer Architecture Input Output Memory.pptx
PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
Empowerment Technology for Senior High School Guide
My India Quiz Book_20210205121199924.pdf
IGGE1 Understanding the Self1234567891011
FORM 1 BIOLOGY MIND MAPS and their schemes
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
What if we spent less time fighting change, and more time building what’s rig...
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Environmental Education MCQ BD2EE - Share Source.pdf
Introduction to pro and eukaryotes and differences.pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Unit 4 Computer Architecture Multicore Processor.pptx
advance database management system book.pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
Cambridge-Practice-Tests-for-IELTS-12.docx
Virtual and Augmented Reality in Current Scenario
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Trump Administration's workforce development strategy
Weekly quiz Compilation Jan -July 25.pdf
Computer Architecture Input Output Memory.pptx
TNA_Presentation-1-Final(SAVE)) (1).pptx

Ncp computer appls num sys1 pramod

  • 1. Conversion of Binary, Octal and Hexadecimal Numbers From Binary to Octal Starting at the binary point and working left, separate the bits into groups of three and replace each group with the corresponding octal digit. 100010112 = 010 001 011 = 2138 From Binary to Hexadecimal Starting at the binary point and working left, separate the bits into groups of four and replace each group with the corresponding hexadecimal digit. 100010112 = 1000 1011 = 8B16 From Octal to Binary Replace each octal digit with the corresponding 3-bit binary string. 2138 = 010 001 011 = 100010112 From Hexadecimal to Binary Replace each hexadecimal digit with the corresponding 4-bit binary string. 8B16 = 1000 1011 = 100010112
  • 2. Conversion of Decimal Numbers From Decimal to Binary 17 12 34 02 69 12 139 12 8 02 4 02 2 02 1 MSD LSD From Binary to Decimal 100010112 = 1×27 + 0×26 + 0×25 + 0×24 + 1×23 + 0×22 + 1×21 + 1×20 = 128 + 8 + 2 + 1 13910 = 100010112
  • 3. Conversion of Fractions Starting at the binary point, group the binary digits that lie to the right into groups of three or four. 0.101112 = 0.101 110 = 0.568 0.101112 = 0.1011 1000 = 0.B816 Problems Convert the following Binary Octal Decimal Hex 10011010 2705 2705 3BC Binary Octal Decimal Hex 10011010 232 154 9A 10111000101 2705 1477 5C5 101010010001 5221 2705 A91 1110111100 1674 956 3BC 5 42 28 338 28 2705 18 10=A 169 916 2705 116
  • 4. Add 1 1 1 1 1 0 0 1 1 + 1 0 0 1 + 1 1 1 0 1 1 0 0 0 1 0 0 0 0 1 Subtract 1 1 0 0 0 1 0 0 1 1 - 1 1 1 1 - 1 1 1 1 1 0 0 1 1 0 0 Multiply normally for implementation - add the shifted multiplicands one at a time. 1 1 1 0 = 14 1 1 1 0 * 1 1 0 1 = 13 * 1 1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 + 0 0 0 0 1 1 1 0 0 1 1 1 0 + 1 1 1 0 + 1 1 1 0 1 0 1 1 0 1 1 0 1 0 0 0 1 1 0 + 1 1 1 0 1 0 1 1 0 1 1 0 (8 bits)
  • 5. Divide 1 1 0 1 1 1 0 1 1 1 1 ) 1 1 0 0 0 1 0 1 | 1 1 0 1 ) 1 0 1 1 0 0 1 | 1 1 1 1 | 1 1 0 1 | 1 0 0 1 1 0 1 | 1 0 0 1 0 1 | 1 1 1 1 | 1 1 0 1 | 1 0 0 0 1 | 1 0 1 1 | 0 0 0 0 | 0 0 0 0 | 1 0 0 0 1 | 1 0 1 1 1 1 1 1 | 1 0 1 0 0 1 1 1 0 1 ) 1 1 1 1 0 0 1 | 1 1 0 1 | 1 0 0 0 1 | 0 0 0 0 | 1 0 0 0 1 | 0 0 0 0 | 1 0 0 0 1 | 1 1 0 1 | 1 0 0
  • 6. Sign-Magnitude 0 = positive 1 = negative n bit range = -(2n-1 -1) to +(2n-1 -1) 4 bits range = -7 to +7 2 possible representation of zero. 2's Complement flip bits and add one. n bit range = -(2n-1 ) to +(2n-1 -1) 4 bits range = -8 to +7 0 0 0 0 = 0 0 0 0 1 = 1 0 0 1 0 = 2 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 = 7 1 0 0 0 = -8 1 0 0 1 = -7 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 = -2 1 1 1 1 = -1 Example 1 1 1 0 = 14 0 0 0 1 flip bits 0 0 1 0 add one WRONG this is not -14. Out of range. Need 5 bits 0 1 1 1 0 = 14 1 0 0 0 1 flip bits 1 0 0 1 0 add one. This is -14. Sign Extend add 0 for positive numbers add 1 for negative numbers
  • 7. Add 2's Complement 1 1 1 0 = -2 1 1 1 0 = -2 + 1 1 0 1 = -3 + 0 0 1 1 = 3 1 1 0 1 1 ignore carry = -5 1 0 0 0 1 ignore carry = 1 Be careful of overflow errors. An addition overflow occurs whenever the sign of the sum if different from the signs of both operands. Ex. 0 1 0 0 = 4 1 1 0 0 = -4 + 0 1 0 1 = 5 + 1 0 1 1 = -5 1 0 0 1 = -7 WRONG 1 0 1 1 1 ignore carry = 7 WRONG Multiply 2's Complement 1 1 1 0 = -2 1 1 1 0 = -2 * 1 1 0 1 = -3 * 0 0 1 1 = 3 1 1 1 1 1 1 1 0 sign extend to 8 bits 1 1 1 1 1 1 1 0 sign extend to 8 bits + 0 0 0 0 0 0 0 + 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 0 ignore carry = -6 + 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 ignore carry + 0 0 0 1 0 negate -2 for sign bit 1 0 0 0 0 0 1 1 0 ignore carry = 6 1 0 0 1 0 = -14 * 1 0 0 1 1 = -13 1 1 1 1 1 1 0 0 1 0 sign extend to 10 bits + 1 1 1 1 1 0 0 1 0 1 1 1 1 1 0 1 0 1 1 0 ignore carry + 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 + 0 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 + 0 0 1 1 1 0 negate -14 for sign bit 1 0 0 1 0 1 1 0 1 1 0 ignore carry = 182
  • 8. Floating-Point Numbers mantissa x (radix)exponent The floating-point representation always gives us more range and less precision than the fixed-point representation when using the SAME number of digits. 11-bit excess 1023 charactstic Mantissa sign 52-bit normalized fraction Sign exponent Mantissa sign Mantissa magnitude 8-bit excess-127 characteristic Mantissa sign 23-bit normalized fraction General format 32-bit standard 64-bit standard 0 1 12 63 31910 Implied binary point Normalized fraction - the fraction always starts with a nonzero bit. e.g. 0.01 … x 2e would be normalized to 0.1 … x 2e-1 1.01 … x 2e would be normalized to 0.101 … x 2e+1 Since the only nonzero bit is 1, it is usually omitted in all computers today. Thus, the 23-bit normalized fraction in reality has 24 bits. The exponent is represented in a biased form. • If we take an m-bit exponent, there are 2m possible unsigned integer values. • Re-label these numbers: 0 to 2m -1 → -2m-1 to 2m-1 -1 by subtracting a constant value (or bias) of 2m-1 (or sometimes 2m-1 -1). • Ex. using m=3, the bias = 23-1 = 4. Thus the series 0,1,2,3,4,5,6,7 becomes -4,-3,-2,- 1,0,1,2,3. Therefore, the true exponent -4 is represented by 0 in the bias form and -3 by +1, etc. • zero is represented by 0.0 … x 20 . Ex. if n = 1010.1111, we normalize it to 0.10101111 x 24 . The true exponent is +4. Using the 32-bit standard and a bias of 2m-1 -1 = 28-1 -1 = 127, the true exponent (+4) is stored as a biased exponent of 4+127 = 131, or 10000011 in binary. Thus we have 0 | 1 0 0 0 0 0 1 1 | 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Notice that the first 1 in the normalized fraction is omitted. The biased exponent representation is also called excess n, where n is 2m-1 -1 (or 2m-1 ).