What is number system? A number system is a basic symbol to represent a set of quantities. There are many types of number system. But here, we are only focus on three number system which are decimal, binary and hexadecimal number.
Here, i put a video that i think it will help you to understand more what are the binary, decimal and hexadecimal number. This video is from Khan Academy, a world-class education on youtube.
What is a base for number system types?
There are of 4 types of number system types which are :
1. binary no. systems- which has its base as 2
2. octal - base-8
3. decimal- base-10
4. hexadecimal - base 16
but here, i just focus on there of them which are binary(base 2), decimal(base 10) and hexadecimal(base 16).
- BINARY NUMBER (BASE 2)
* base 2
*The number consists only two digit : 1 and 0
The weight structure of binary number |
*The least significant bit (LBS) and most significant bits (MBS) is depends on the size of binary number.
- DECIMAL NUMBER
*Base 10
*The value of the assigned weight is composed by 10 digits : from 0 to 9.
- HEXADECIMAL NUMBER
*Base 16
*The composed number start from 0 until F
*The hexadecimal system is useful because it can represent every byte (8 bits) as two consecutive hexadecimal digits.
Number System Conversion |
PREPARED BY : SITI ROSNIEZA EILISA BINTI JAMAL (B031410230)
1.2: NUMBER SYSTEM CONVERSION
When we type some letters or words, the computer translates them in numbers as computers can understand only numbers.
There are many methods or techniques which can be used to convert numbers from one base to another.
Binary Number System:
BINARY to DECIMAL
steps:
- Determine column( positional) value of each unit
- Multiply the obtained column values (in Step 1) by the digits in the corresponding columns.
- Sum the products calculated in Step 2. The total is the equivalent value in decimal.
Example 1:
Binary Number : 111012
Calculating Decimal Equivalent:
101112 =
Weight
|
24
|
23
|
22
|
21
|
20
|
Value represented
|
16
|
8
|
4
|
2
|
1
|
Binary(*)
|
1
|
0
|
1
|
1
|
1
|
101112 = 16+4+2+1
Binary Number : 101112 = Decimal Number : 2310
BINARY to HEXADECIMAL
steps:
- Divide the binary digits into groups of four (starting from the right).
- Convert each group of four binary digits to one hexadecimal symbol.
Example 2:
0.10112 =
8+0+2+0=10(A) 8+4+0+1=13(D)
↑
↑
1110
|
1010
|
0101
|
1101
|
1001
|
.
|
011
|
↓ ↓ ↓ ↓ 8+4+2+0+14(E) 0+4+0+1=5 8+0+0+1=9 0+4+2+0=6
11101010010111011001.0112 = EA5D9.616
Octal Number System
The base of octal system is 8.
OCTAL to BINARY:
Example 1:
Octal: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Binary: | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 |
| |||||||||
|
OCTAL to HEXADECIMAL:
Example 2 :
Drop any leading zeros or pad with leading zeros to get groups of four binary digits (bits):
Binary 011100101 = 1110 0101
PREPARED BY : WAN NORAQILAH BINTI A.RAZAK
Property
Two's complement representation allows the use of binary arithmetic operations on signed integers, yielding the correct 2's complement results.
Positive Numbers
Positive 2's complement numbers are represented as the simple binary.
Negative Numbers
Negative 2's complement numbers are represented as the binary number that when added to a positive number of the same magnitude equals zero.
If the sign bit is zero,
then the number is greater than or equal to zero, or positive.
If the sign bit is one,
then the number is less than zero, or negative.
Calculation Of 2's Complement
ADDITON
5 + (-3) = 2 0000 0101 = +5
+ 1111 1101 = -3
0000 0010 = +2
SUBTRACTION
7 - 12 = -5 0000 0111 = +7
- 1111 0100 = -12
1111 1011 = -5 ← answer from 2's complement must be convert to the binary number.
Hence, 1111 1011 to be 0000 0101.
MULTIPLICATION
(-4) × 4 = -16 1111 1100 = -4
x 0000 0100 = 4
1111 0000 = -16← answer from 2's complement must be convert to the binary
number. Hence, 1111 0000 to be 0001 0000.
DIVISION
7 ÷ 3 = 2 remainder 1 0000 0111 = +7 0000 0100 = +4
1111 1101 = -3 1111 1101 = -3
0000 0100 = +4 0000 0001 = +1 (remainder)
Binary Multiplication
1 6 F
+ 4 A 2
----------------
6 1 1
-----------------
When converting from octal to hexadecimal, it is often easier to first convert the octal number into binary and then from binary into hexadecimal.
For example, to convert 345 octal into hex:
Octal = | 3 | 4 | 5 | |
Binary = | 011 | 100 | 101 | = 011100101 binary |
Drop any leading zeros or pad with leading zeros to get groups of four binary digits (bits):
Binary 011100101 = 1110 0101
Then, look up the groups in a table to convert to hexadecimal digits.
Binary: | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 |
Hexadecimal: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Binary: | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
Hexadecimal: | 8 | 9 | A | B | C | D | E | F |
Binary =
|
1110
|
0101
|
Hexadecimal
= E5 hex
Decimal Number System:
DECIMAL to HEXADECIMAL:
Example 1:
DECIMAL = 1792
Decimal: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Hexadecimal: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Decimal: | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
Hexadecimal: | 8 | 9 | A | B | C | D | E | F |
DECIMAL to BINARY:
Example 2:
| |||||||||||||||||||||||||||||
Hexadecimal Number System:
Steps:
- Convert each hexadecimal digit to a 4 digit binary number
- Combine all the resulting binary groups (of 4 digits each) into a single binary number.
Example 1:
Hexadecimal to Binary
Converting from hexadecimal to binary is as easy as converting from binary to hexadecimal. Simply look up each hexadecimal digit to obtain the equivalent group of four binary digits.
Hexadecimal: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Binary: | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 |
Hexadecimal: | 8 | 9 | A | B | C | D | E | F |
Binary: | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
Hexadecimal
=A2DE
Binary =1010001011011110
binary
Example 2:
Hexadecimal to Decimal:
This is quite simple.Multiply the second hex digit by 16 and then add the first digit to it
Hexadecimal = 2E
2 x 16 = 32
E = 14
14 + 32 = 46
https://www.youtube.com/watch?v=Y0ybldaI5_M
- http://www.byte-notes.com/number-system-computer
- http://www.tutorialspoint.com/computer_fundamentals/computer_number_conversion.htm
- http://www.robotroom.com/NumberSystems3.html
- http://www.teach-ict.com/gcse_computing/ocr/214_representing_data/number/miniweb/pg4.htm
- http://www.is.wayne.edu/OLMT/BINARY/PAGE3.HTM
PREPARED BY : WAN NORAQILAH BINTI A.RAZAK
2.4) COMPLEMENT NUMBER
Negative Number Conversion
• Complements are used to simplify the subtraction
operation and for logical manipulations.
• For each base (r), there are two complements:
• (r-1)'s complement, also called diminished radix
complement
• r's complement, also called radix complement.
• (r-1)'s complement Æ For any integer number N in base r
with number of digits equal n we define:
• (r-1)'s complement of N = r N n ( −1)− .
• R's complement of N = r N n − = (r-1)'s complement + 1
ADDITON
5 + (-3) = 2 0000 0101 = +5
+ 1111 1101 = -3
0000 0010 = +2
SUBTRACTION
7 - 12 = -5 0000 0111 = +7
- 1111 0100 = -12
1111 1011 = -5 ← answer from 2's complement must be convert to the binary number.
Hence, 1111 1011 to be 0000 0101.
MULTIPLICATION
(-4) × 4 = -16 1111 1100 = -4
x 0000 0100 = 4
1111 0000 = -16← answer from 2's complement must be convert to the binary
number. Hence, 1111 0000 to be 0001 0000.
DIVISION
7 ÷ 3 = 2 remainder 1 0000 0111 = +7 0000 0100 = +4
1111 1101 = -3 1111 1101 = -3
0000 0100 = +4 0000 0001 = +1 (remainder)
- http://opencourseware.kfupm.edu.sa/colleges/ces/ee/ee200/files%5C3-Handouts_Lecture_3.pdf
- http://academic.evergreen.edu/projects/biophysics/technotes/program/2s_comp.htm
- https://www.youtube.com/watch?v=u01imtvqsrU
PREPARED BY : SITI NORHAYATI BINTI MASHUDI
BINARY NUMBER OPERATION
BINARY NUMBER OPERATION
Binary Addition
Example:
Consider the addition of decimal numbers:
23
+48
___
~We begin by adding 3+8=11. Since 11 is greater than 10, a one is put into the 10's column (carried), and a 1 is recorded in the one's column of the sum.
~ Next, add {(2+4) +1} (the one is from the carry)=7, which is put in the 10's column of the sum. Thus, the answer is 71.
Binary addition works on the same principle, but the numerals are different. Begin with one-bit binary addition:
0 0 1
+0 +1 +0
___ ___ ___
0 1 1
~1+1 carries us into the next column. In decimal form, 1+1=2. In binary, any digit higher than 1 puts us a column to the left (as would 10 in decimal notation). The decimal number "2" is written in binary notation as "10" (1*2^1)+(0*2^0).
~Record the 0 in the ones column, and carry the 1 to the twos column to get an answer of "10." In our vertical notation,
1
+1
___
10
The process is the same for multiple-bit binary numbers:
1010
+1111
______
· Step one:
Column 2^0: 0+1=1.
Record the 1.
Column 2^0: 0+1=1.
Record the 1.
Temporary Result: 1; Carry: 0
· Step two:
Column 2^1: 1+1=10.
Record the 0, carry the 1.
Temporary Result: 01; Carry: 1
Column 2^1: 1+1=10.
Record the 0, carry the 1.
Temporary Result: 01; Carry: 1
· Step three:
Column 2^2: 1+0=1 Add 1 from carry: 1+1=10.
Record the 0, carry the 1.
Temporary Result: 001; Carry: 1
Column 2^2: 1+0=1 Add 1 from carry: 1+1=10.
Record the 0, carry the 1.
Temporary Result: 001; Carry: 1
· Step four:
Column 2^3: 1+1=10. Add 1 from carry: 10+1=11.
Record the 11.
Final result: 11001
Column 2^3: 1+1=10. Add 1 from carry: 10+1=11.
Record the 11.
Final result: 11001
Alternately:
11 (carry)
1010
+1111
______
11001
Always remember
· 0+0=0
· 1+0=1
· 1+1=10
Binary substraction
Rules of Binary Subtraction
- 0 - 0 = 0
- 0 - 1 = 1, and borrow 1 from the next more significant bit
- 1 - 0 = 1
- 1 - 1 = 0
For example,
00100101 - 00010001 = 00010100 | 0 | borrows | ||
0 0 | = | 37(base 10) | ||
- 0 0 0 1 0 0 0 1 | = | 17(base 10) | ||
0 0 0 1 0 1 0 0 | = | 20(base 10) | ||
00110011 - 00010110 = 00011101 | 0 10 1 | borrows | ||
0 0 | = | 51(base 10) | ||
- 0 0 0 1 0 1 1 0 | = | 22(base 10) | ||
0 0 0 1 1 1 0 1 | = | 29(base 10) |
Binary Multiplication
Multiplication in the binary system works the same way as in the decimal system:
must remember
· 1*1=1
· 1*0=0
· 0*1=0
101
* 11
____
101
1010
_____
1111
Note that multiplying by two is extremely easy. To multiply by two, just add a 0 on the end.
Binary Division
Follow the same rules as in decimal division. For the sake of simplicity, throw away the remainder.
For Example: 111011/11
10011 r 10
_______
11)111011
-11
______
101
-11
______
101
11
______
10
https://www.youtube.com/watch?v=sFd5bnDdB3Q
http://academic.evergreen.edu/projects/biophysics/technotes/misc/bin_math.htm
PREPARED BY:NOR FADILA BT MOHD YUNUS
HEXADECIMAL NUMBER OPERATION
HEXADECIMAL ADDITION.
Use the following steps to perform hexadecimal addition:
1. Add one column at a time.
2. Convert to decimal and add the numbers.
3.(a) If the result of step two is 16 or larger subtract the result from 16 and carry 1 to the next column.
(b) If the result of step two is less than 16, convert the number to hexadecimal
Example 1 :
Add 16F16 + 4A216.
1 1 ← Carried over digits1 6 F
+ 4 A 2
----------------
6 1 1
-----------------
Example 2 :
Add C4BDF16 + E2CA916.
HEXADECIMAL SUBTRACTION.
Firstly,we have to convert the hexadecimal number to binary number.Then,take the 2's complement of the binary number and change it back to hexadecimal number.Add both numbers to get the result.
add 1 to that to get F316, and add that to 1B16 to get:
F F - 0 D - - F 2
c 1 B + F 3 - - 0 E
1 B - 0 D - - ?
becomes
since 1016 + B16 - D16 is E16.
(1016) 0 B - 0 D - - 0 E
HEXADECIMAL MULTIPLICATION.
Prepared by: Masturah Binti Mohammad Liza
Great blog. All posts have something to learn. Your work is very good and I appreciate you and hopping for some more informative posts. संख्या पद्धति
ReplyDelete