Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
25 views36 pages

Number System

The document provides an overview of various number systems including octal, hexadecimal, and their conversions to and from decimal. It explains the representation of signed numbers in binary using sign-magnitude, 1's complement, and 2's complement forms, along with their arithmetic operations. Additionally, it discusses the challenges and methods for converting between different number systems.

Uploaded by

21btc143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views36 pages

Number System

The document provides an overview of various number systems including octal, hexadecimal, and their conversions to and from decimal. It explains the representation of signed numbers in binary using sign-magnitude, 1's complement, and 2's complement forms, along with their arithmetic operations. Additionally, it discusses the challenges and methods for converting between different number systems.

Uploaded by

21btc143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

The Octal Number System

• The octal number system is base-8 system. It has 8 symbols:


• 0,1,2,3,4,5,6,7

Decimal Number Octal Number Decimal Number Octal Number

0 0 8 10
1 1 9 11
2 2 10 12
3 3 11 13
4 4 12 14
5 5 13 15
6 6 14 16
7 7 15 17
Use of Octal System
•Octal became widely used in computing when
systems such as the UNIVAC 1050, PDP-8, ICL 1900
and IBM mainframes employed 6-bit, 12-bit, 24-bit or
36-bit words. Octal was an ideal abbreviation of
binary for these machines because their word size is
divisible by three (each octal digit represents three
binary digits).
Octal to Decimal Conversion
•(56)8 to Decimal
•5x8 + 6= 46
•(234.42)8 Octal to Decimal.
•2x64+3x8+4x1 + 4x(1/8)+2(1/64) =
128+24+4+0.5+0.015625 = 156.515625

•(97.5)8 Octal
•Invalid octal number.
•(1.9)8 Octal
•Invalid octal number.
Decimal to Octal conversion
•(99)10 to Octal
• 8 ) 99
• 8) 12 3
• 8) 1 4
• 0 1

• (99)10 = (143)8
•(245.8125)10
• 8)245
• 8) 30 5
• 8) 3 6
• 0 3
• 8x0.8125 = 6.5 6
• 8x0.5 = 4.0 4
•Octal number is (365.64)
Hexadecimal Numbers
• The hexadecimal number system is base-16 system. It has 16 symbols:
• 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

Decimal Hexadec Decimal Hexadec Decimal Hexadec Decimal Hexadec


Number imal Number imal Number imal Number imal
Number Number Number Number
0 0 8 8 16 10 24 18
1 1 9 9 17 11 25 19
2 2 10 A 18 12 26 1A
3 3 11 B 19 13 27 1B
4 4 12 C 20 14 28 1C
5 5 13 D 21 15 29 1D
6 6 14 E 22 16 30 1E
7 7 15 F 23 17 31 1F
Hexadecimal to Decimal Conversion
• (A12)16 to Decimal
• 10x16x16 + 1x16 +2x1 = 10x256 + 16 +2 = 2578
• (A12)16 = (2578)10

• (B.C)16 to Decimal
• 11 + 12/16 = 11.75
Decimal to Hexadecimal Conversion
• (469.6875)10 to Hexadecimal

• 16 ) 469
• 16) 29 5
• 16) 1 13
• 0 1
• Integer Part 1D5
• Fractional Part
• 16 x 0.6825 = 11.0 11
• 0
• Finally (1D5.B)16
Conversions Between Different Number Systems
•(1001 0111 1001)2 to Hexadecimal
•Here we have to group four bits together starting from
right side.
• (979)16
• (111 0101 1011)2 to Hexadecimal
•Here we have to group four bits together starting from
right side. Since we have only three bits in the end so
leading zero to be assumed.
•So (75B)16 is answer.
Conversions Between Different Number Systems
•(100 101 111 001)2 to Octal
•Here we have to group three bits together starting
from right side.
•(4571)8
•(11 100 111)2 to Octal
• Here we have to group three bits together starting
from right side. Since we have only two bits in the end
so leading zero to be assumed.
•(347)8 is answer.
Conversions Between Different Number Systems
•(362)8 to Binary
•Here we have to write three bit binary number for
each digit. Leading zeros in integer part may be
ignored.
•(011 110 010)2 = (11 110 010)2
•(45.26)8 to Binary
• Here we have to write three bit binary number for
each digit trailing zero after decimal may be ignored
•(100 101.010 110)2 = (100 101.010 11)2
Conversions Between Different Number Systems
•(7AB)16 to Binary
•Here we have to write four bit binary number for each
digit. Leading zeros in integer part may be ignored.
•(0111 1010 1011)2 = (111 1011 1011)2
•(A8.9C)16 to Binary
• Here we have to write four bit binary number for
each digit trailing zero after decimal may be ignored
•(1010 1000.1001 1100)2 = (1010 1000.1001 11)2
Conversions Between Different Number Systems
•Direct conversion between Hexadecimal to Octal and
vice-versa is very difficult.
•Hence it is done by converting the number to binary or
decimal and then to the required base.
•(64)8 to Hexadecimal
•(110 100)2 = (11 0100)2 = (34)16
•(AB)16 to Octal
•(1010 1011)2 = (10 101 011)2 = (253)8
• 64 octal to convert to hexadecimal division 16 base 10 octal of 16 is 20.
• 20) 64 to binary (110 100) = (0011 0100) = (34) Hex
• 20) 3 4
0 3
Hexadecimal number is 34.
8 ) AB (1010 1011) = ( 010 101 011) = (253) in octal.
8) 15 3
8) 2 5
0 2
Representation of Signed Numbers in Binary
•Let us take 8 bit number
•There are total 256 combinations. If we assumed
unsigned number (Positive Numbers) then
•00 Hexadecimal 0 decimal
•FF Hexadecimal 255 decimal
•10 Hexadecimal 128 decimal
•To represent negative number we have
•1. Sign-magnitude form
•2. Complement form
Representation of Signed Numbers in Binary
•Sign Magnitude

0 1 1 0 1 0 1 1
• Sign Bit=0 positive number ( Value +107)

1 1 1 0 1 0 1 1
• Sign Bit=1 negative number ( Value -107)
•This signed magnitude form here the Most Significant Bit
gives the sign of the number if bit is zero then number is
positive if bit is one number is negative. Remaining bits
gives the magnitude of the number.
Representation of Signed Numbers in Binary
•Sign magnitude representation in 8 bit number Range:
•-127,-126,…-2,-1,-0,+0,1,2,…126,127
•n bit number Range
• -(2(n-1) -1),…,-0,+0,…, (2(n-1) -1)
•Problems:
•1. Two representation of zero
•2. Subtraction requires lot of manipulation not feasible
for computers.
• Signed Magnitude
• 0000 0000 0 Decimal
• 0111 1111 127 Decimal
• 1000 0000 -0 decimal
• 1111 1111 -127 Decimal
Representation of Signed Numbers in Binary
•1’s Complement

0 1 1 0 1 0 1 1
• Sign Bit=0 positive number ( Value +107)

1 0 0 1 0 1 0 0
• Sign Bit=1 negative number ( Value -107)
•This is 1’s compliment form here again sign bit is ‘0’ and
‘1’ for positive and negative number respectively. But
the number is represented in 1’s compliment form i.e.
the number is subtracted from ‘1111 1111’.
Representation of Signed Numbers in Binary
•1’s Complement representation in 8 bit Range:
•-127,-126,…-2,-1,-0,+0,1,2,…126,127.
•n bit number Range
• -(2(n-1) -1),…,-0,+0,…, (2(n-1) -1)

•Problem:
•1. Two representation of zero
Representation of 1’Complement Numbers in
Binary
•Subtraction can be performed feasible for computers.
Many early computers, including the CDC 6600, the
LINC, the PDP-1, and the UNIVAC 1107, used ones'
complement notation. Successors of the CDC 6600
continued to use ones' complement until the late
1980s, and the descendants of the UNIVAC 1107 (the
UNIVAC 1100/2200 series) still do, but the majority of
modern computers use two's complement.
• 1’s Complement Representation
• 0000 0000 0 Decimal
• 0111 1111 127 Decimal
• 1000 0000 -127 decimal
• 1111 1111 -0 Decimal
Representation of Signed Numbers in Binary
•2’s Complement

0 1 1 0 1 0 1 1
• Sign Bit=0 positive number ( Value +107)

1 0 0 1 0 1 0 1
• Sign Bit=1 negative number ( Value -107)
•This is 2’s compliment form here again sign bit is ‘0’ and ‘1’
for positive and negative number respectively. But the
number is represented in 2’s compliment form i.e. the
number is subtracted from ‘1111 1111’ and add 1 to the
Representation of Signed Numbers in Binary
•2’s Complement representation in 8 bit Range:
•-128,-127,…-2,-1,0,1,2,…126,127.
•n bit number Range
• -(2(n-1) ),…,-1,0,…,(2(n-1) -1)
•Most of the computers now use 2’s complement
representation.
• 2’s Complement Representation
• 0000 0000 0 Decimal
• 0111 1111 127 Decimal
• 1000 0000 -128 decimal
• 1111 1111 -1 Decimal
1’s Complement Arithmetic
25 0001 1001 0001 1001
-13 -0000 1101 1111 0010
---------- ---------------- ---------------------
12 0000 1100 1 0000 1011
+1
---------------------
0000 1100

Add end around carry. The answer is positive


1’s Complement Arithmetic
13 0000 1101 0000 1101
-25 -0001 1001 1110 0110
---------- ---------------- ---------------------
-12 -0000 1100 1111 0011(-12)
1 ’s Complement
------------------------
0000 1100 (12)

No end around carry. The answer is negative.


127 highest positive number, -128 negative number.

4910 0011 00012


+4310 + 0010 10112
-------- -----------------
9210 0101 11002
• 4716 0100 0111
• + 5716 0101 0111
• -----------------
• 1001 1110
• (-12)10 (0000 1100) 1’s ( 1111 0011) 2’s 1111 0100
• (-25)10 (0001 1001) 1’s ( 1110 0110) 2’s 1110 0111
-------------- --------------------
(-37)10 11101 1011
Carry Ignore 1101 1011
1’s complement 0010 0100 2’s 0010 0101 37 no. is -37
• (-76)10 1011 01002
• ( -67)10 1011 11012
• -------------- ------------------
• -14310 1 0111 00012
• 0111 0001 (113)

• 0016 010
• 7F16 12710
• 8016 -12810
• FF16 -110
• 4516 6910
• DD16 -3510

• ( 124)b = 3910
• b2 +2b+4 = 39
• b2 +2b-35 = 0
• b2 +7b- 5b -35 = 0
• B=-7, b=5
• Answer base =5
• 4716 0100 0111 0000 0100 0111
• + 5716 0101 0111 0000 0101 0111
• ----------------- --------------------------
• 1001 1110 0000 1001 1110
• (-76)10 11011 01002
• ( -67)10 11011 11012
• -------------- ------------------
• -14310 1 10111 00012


• (-4) 100 4bit 1100
• -4 to 3
• (2) 010 4bit 0010
4716 0100 0111
+ 5716 0101 0111
-----------------
1001 1110

You might also like