Decimal Numbers: These Are Easy To Operate A We Done Daily Calculations in This Number System
Decimal Numbers: These Are Easy To Operate A We Done Daily Calculations in This Number System
© 2017 learncoal.com 1
Binary Numbers
These numbers are represented in digits of 0
and 1 only.
It is also known as Base 2.
All the work done by computer system is in
binary numbers.
These are difficult to operate by humans as
a single number ranges from 8bits to 64 bits
so its difficult to remember and to solve
daily calculations.
© 2017 learncoal.com 2
Hexadecimal Numbers
These numbers are represented in digits of 0 to 15.
Here, first ten are the same as decimal numbers while
the other six are alphabets used for numbers from 10
to 15 as A to F respectively.
It is also known as Base 16.
It is the direct mapping of binary numbers and
hence easy to convert from binary.
These are comparatively easy to operate by humans
than binary as it shortens the length of numbers from
32 bits to 8 hexadigits.
Each hexadecimal digit corresponds to 4 binary bits.
© 2017 learncoal.com 3
Hexadecimal Integers
Binary values are represented in hexadecimal.
© 2017 learncoal.com 4
Conversion: Decimal Numbers
to Binary Numbers
Repeatedly divide the decimal integer by 2.
Each remainder is a binary digit in the
translated value. i.e. (37)10 = (100101)2
© 2017 learncoal.com 5
Conversion: Binary Numbers
to Decimal Numbers
Weighted positional notation shows how to calculate the
decimal value of each binary bit:
( ) 10 = (Bn-1 2n-1) + (Bn-2 2n-2) + ... + (B1 21) + (B0 20)
B = Binary digit
= 0 + 64 + 0 + 0 + 8 + 0 + 0 + 1
=75
© 2017 learncoal.com 6
Conversion: Binary Numbers to
Hexadecimal Numbers Vice Versa
Each hexadecimal digit corresponds to 4 binary
bits.
Example: Translate the binary integer
000101101010011110010100 to hexadecimal:
(000101101010011110010100)2 = (16A794)16
© 2017 learncoal.com 7
Conversion: Decimal Numbers to
Hexadecimal Numbers
Repeatedly divide the 16.
Each remainder is a hexa digit in the
translated value.
i.e. (422)10 = (1A6)16
© 2017 learncoal.com 8
Conversion: Hexadecimal
Numbers to decimal Numbers
Multiply each digit by its corresponding
power of 16:
( ) 10 = (Dn 16n) + …(D3 163) + (D2 162) + (D1 161) + (D0
160)
carry: 1
0 0 0 0 0 1 0 0 (4)
+ 0 0 0 0 0 1 1 1 (7)
0 0 0 0 1 0 1 1 (11)
bit position: 7 6 5 4 3 2 1 0
© 2017 learncoal.com 10
Hexadecimal Addition
Divide the sum of two digits by the number base (16).
The quotient becomes the carry value, and the
remainder is the sum digit.
1 1
66 35 48 5A
69 38 58 3B
CF 6D A0 95
21 / 16 = 1, rem 5
© 2017 learncoal.com 11
Hexadecimal Subtraction
When a borrow is required from the digit to the
left, add 16 (decimal) to the current digit's value:
16 + 5 = 21
-1
DF 95
A6 57
39 3E
© 2017 learncoal.com 12
Integer Numbers
In computer system, programmer should know that
the number usage is dependent on the programmers
the way they want to use.
The range of the number varies for signed and
unsigned numbers having same size.
Integer range is considered to be -∞ to +∞.
While here the range depends on the number of bits used
by the data type.
If the data type is BYTE than it uses 8 bits while if it is
WORD than it uses 16 bits and so on.
© 2017 learncoal.com 14
Signed Integer Numbers
In computer system, it is known that the most
significant bit shows whether the number is positive
or negative.
Hence the range of positive number hold by signed
number reduces.
Here, if the data type is BYTE than it uses 8 bits but
range is (-27 to 27-1) while if it is WORD than it uses
16 bits but range is (-215 to 215-1) and so on.
Consider this number: 11001100. If the programmer
uses that value in a unsigned integer than it is a
positive number (204) while if the programmer uses it
in a signed integer than it is a negative number (-56).
© 2017 learncoal.com 15
Test your understanding!
Solve it.
1. Conversion
A. ( 110100111101 )2 = ( ) 10 = ( )16
B. ( 3B0BD1EF ) 16 = ( ) 10 = ( ) 2
2. Operation
A. Add ( 11010110 )2 and (10110011 ) 2
16
© 2017 learncoal.com