Describe How Data Are Stored and Manipulated Within The Computer
Describe How Data Are Stored and Manipulated Within The Computer
Binary
Computer systems manipulate numbers. Inside the computer, the numbers are represented as bits or bytes that represent words.
For example, the number three is represented by a byte with bits 0 and 1 set; 00000011. This is numbering system using base 2. People commonly use a decimal or Base 10 numbering system. What this means is that in Base 10, count from 0 to 9 before adding another digit. The number 22 in Base 10 means we have 2 sets of 10's and 2 sets of 1's.
Base 2 is also known as binary since there can only be two values for a specific digit; either a 0 = OFF or a 1 = ON. You cannot have a number represented as 22 in binary notation. The decimal number 22 is represented in binary as 00010110 which by following the below chart breaks down to:
Bit 7 6 5 4 3 2 1 0 Position 1 1 1 1 1 1 1 1 Decimal 128 64 32 16 8 4 2 1
22 or 00010110:
All numbers representing 0 are not counted, 128, 64, 32, 8, 1 because 0 represents OFF However, numbers representing 1 are counted, 16 + 4 + 2 = 22 because 1 represents ON
1. A base 2 number system that uses 8-bits has each represented by the numeric values of 0 or 1, also known as ON or OFF, UP or DOWN, and is the primary language that computers use to communicate. Below is an example of the maximum 8-bit value of 255, which is 11111111 in binary. To get this value add each column, so 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 = 255.
Value: 128 64 32 16 8 4 2 1 1 1 1 1111
ON/OFF: 1
Tip: Counting on a computer normally start with 0, instead of 1. Therefore, counting all the bits does equal 255, however, if you start at 0, it is really 256. Below is another example of 10001101, which is 141 or 1 + 4 + 8 + 128.
Value: 128 64 32 16 8 4 2 1
ON/OFF: 1
0 0 0 1101
Real Numbers There are two types of real numbers, Fixed-Point and Floating Point. Fixed Point Fixed point data items are numbers which have embedded decimal point i.e. 1.5, 458.4589, -0.569.
Floating Point Floating point data items are numbers, which are, held as binary fractions by a computer. The numbers are expressed in a form where you have a mantissa and an exponent. The exponent indicates how many digits the decimal point should move. For example an exponent of 2 indicates that you move the decimal point to the right by two places to get the original number 12.3. Then, an exponent of -3 would take the decimal point to the left by three places to again, obtain the 0.000123. Note that we are not changing the original number, only representing it in a different form so that it can be stored in the computer.
Exponent 2 6 -3
123000 = 0.123 * 10
0.000123 =0.123 * 10
If you are given a four bit number example such as 10012 and you are asked to represent it as an 8 bit negative binary number, you can add zeroes as a place filler to the left then a 1 at the on the eighth until you have bits in total. For example 10012 as an eighth bit negative number is 100010012. 10012 displayed as a positive number 000010012.
25010 = 0010010100002
We can take this a little further. 1010 = Positive sign (+) 1011 = Negative sign (-)
Therefore
Octal
A base-8 number system commonly used to represent binary numbers and other numbers in a shorter form. Below is a basic chart of how a binary number comprising 8 bits is converted to an octal number.
Binary Octal 1 +200 1 +100 1 +40 1 +20 1 +10 1 +4 1 +2 1 +1
Below are some binary examples and their octal equivalents. 10001111 = 200 + 0 + 0 + 0 + 10 + 4 + 2 + 1 = 217 10101111 = 200 + 0 + 40 + 0 + 10 + 4 + 2 + 1 = 257 Can you calculate 11010100 to be 324?
To convert a value from hexadecimal to binary, you merely translate each hexadecimal digit into its 4-bit binary equivalent. Hexadecimal numbers have either and 0x prefix or an h suffix. For example, the hexadecimal number: 0x3F7A Translates into, Using the Binary chart and the below chart for Hex: 0011 1111 0111 1010
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
1. Alternatively referred to as Base 16 and hex, the hexadecimal numbering system uses combinations of 16 digits and characters (letters) to represent all numerical values. In addition to the ten numbers in the decimal system (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9), hexadecimal also uses the letters A through F to create a hexadecimal number. For example, "computer hope" in hexadecimal becomes "636f6d707574657220686f7065".
Anyone who has designed a web page has encountered hexadecimal value when doing colors. For example, to create red text use the HTML color code #FF0000, which translates to 255 Red, 0 Green, and 0 Blue in hexadecimal.
Ones complement
To convert a number using the ones complement, simply change the 0s to 1s and the 1s to 0s. So the ones complement of 111010112 is 000101002. Also the ones complement of 000101002 is 111010112.
Twos complement
This is another method for representing signed integers. Steps a. Write the integer in its sign and magnitude form b. Flip the bits, i.e. change all 1s to 0s to 1s c. Add a bit 1 to this number
Example Write the following decimal integers twos complement representation using 8 bit store: a) 9 b) -9 Solution a) 0000 0110 sign and magnitude form 1111 0110 flip the bits Ans 1111 0111 add bit 1
b) 1000 1001 sign and magnitude 0111 0110 flip the bits Ans 0111 0111 add bit 1
65 90 97 122 49 57