100% found this document useful (1 vote)
2K views

Describe How Data Are Stored and Manipulated Within The Computer

Uploaded by

api-247871582
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views

Describe How Data Are Stored and Manipulated Within The Computer

Uploaded by

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

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

Decimal Values and Binary Equivalents chart


Decimal 1 2 3 4 5 6 7 8 9 10 16 32 64 100 256 512 1000 1024 Binary 1 10 11 100 101 110 111 1000 1001 1010 10000 100000 1000000 1100100 100000000 1000000000 1111101000 10000000000

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.

Number 12.3 = 0.123 * 10


2 6 -3

Mantissa 0.123 0.123 0.123

Exponent 2 6 -3

123000 = 0.123 * 10

0.000123 =0.123 * 10

Signs and Magnitude in Binary


Negative signs are not used in binary however the bit zero (0) at the furthest left is used to indicate that a number is positive. While a 1 placed at the furthest left of a note indicates that the number is negative. For example: 001011012 is positive 101011012 is negative

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.

000010012= 910 100010012 = -910

Binary Coded Decimal (BCD).


This is a method used to represent decimal numbers in a simpler way. If you were to convert 25010 to binary you would normally have to divide it by 2 and record the remainders. However using Binary Coded Decimal (BCD), each digit is represented in binary by a 4-bit binary code. Digit (Base 10) Binary code 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Therefore 25010 can be represented as 2 0010 5 0101 0 0000

25010 = 0010010100002

We can take this a little further. 1010 = Positive sign (+) 1011 = Negative sign (-)

Therefore

250 represented in BCD is 1010 0010 0101 0000


+ And -250 represented in BCD is 1011 0010 0101 0000 2 5 0 2 5 0

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?

Hexadecimal numbering system


The other major numbering system used by computers is hexadecimal, or Base 16. In this system, the numbers are counted from 0 to 9, then letters A to F before adding another digit. The letter A through F represent decimal numbers 10 through 15, respectively. The chart below indicates the values of the hexadecimal position compared to 16 raised to a power and
decimal values. It is much easier to work with large numbers using hexadecimal values than decimal.

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

ASCII codes (American Standard Code for Information Interchange)


So far we have been using binary to represent numbers. ASCII codes is used to represent number, symbols as well as things as DELETE, BACKSPACE, etc. Basic concept of the ASCII Each code takes up 1 byte (8bits) Capital letters are represented with the binary digits for: Lower case letters by the binary digits for: The digits 0 9 by the binary digits for: Example The Ascii code for D is 010001002. What is the binary code for W? D is the 4th letter of the alphabet while W is the 23rd . 23 4 = 19. We should therefore add the binary equivalent 19 to the ASCII code of D. Thus: binary code for D Binary code for 19 01000100 +00010011 01010111

65 90 97 122 49 57

The ASCII code for W is 010101112

You might also like