Data representation
The main things that this whole chapter of computer system architecture is about are,
1. Binary numbers
2.Decimal number
3.Octal numbers
4.Hexadecimal numbers
and what we are learning about them is how to convert them to one another and also differentiate them individually.
first of all Binary Numbers
binary numbers consist of 1 and 0s
conversion of binary numbers are many, like for example to decimal=
and vise versa
or the conversion to octal and vise versa
or also the conversion from binary to hexadecimal and vise versa
the conversion from octal to hexadecimal needs to go through binary first
before we go further let me show you how to convert decimal to both octal and hexadecimal so no one gets confused
this is the conversion of octal to decimal, what is shown, is the converion of 26525 to the base of 8 to decimal
this is the conversion of 949 in decimal to hexadecimal
this is a conversion from hexadecimal to octal, as you can see they first convert it into binary hence then converting it again into octal
this is the conversion of hexadecimal to decimal
there is also addition and subtractions for these numbers!!
starting with binary addition,
these are the rules that need to be followed in order to carry out addition in binary
and here is the way to solve it, like any addition, we start from our rightmost and work our way to the left,
if there is a 1+1 going on, the way to solve it is to put 0 at the answer box at the bottom and bring up a 1 to the next rightmost addition.
the next one is the octal addition and subtraction
the rule of octal addition is, when the addition of two numbers is more than 7, for example, 7+5=12, which means its more than 7, what you do is, 12-8 and then you get 4, that is the answer for the addition of the two numbers in octal.
in octal subtraction on the other hand, instead of worrying if it is more than 8 we need to worry that its less than 8, which means that, if the number subtracting the other number below it is lesser then the number it is subtracting, we need to borrow 8 from the right side of the subtracting number.
the hexadecimal addition and subtraction
the rules for hexadecimal addition and subtractions are equal to those of octal subtraction and additions, whats different is the number of importance which is now 16
for addition, if the addition of number is more than 15 the added number needs to be subtracted by 16 to get the answer
for subtraction, the number that is burrowed if the subtractor is lesser than the subtracting value is 16 instead of 8 and is taken from the most right to the values, number.
Two's Compliment
this picture shows that it is carrying out addition but ipn reality it is as matter of fact a subtraction henceforth, the negative number will be 112, the binary of 112 without the negative is 01110000
so now we flip it into 10001111 and add one to it which becomes 10010000 ans finally add it with 80 and walla!!! answer solved.
No comments:
Post a Comment