Data Representation

Positive numbers- These are represented on a computer using binary. In a 8 bit binary system meaning the number is between 0 and 255 the numbers 1 and 0 are put under the correct numbers in the binary system so it adds up to the decimal number e.g.

128 64 32 16 8 4 2 1
0    0   1   0  1 1 0 1 = 45

Negative numbers- These can be represented through either two’s compliments or signed bit. Signed bit uses the starting number to determine wether the number is negative or positive. 1 = negative
0 = positive. This causes an error though as it can produce 0 and -0. The better method is to use two’s compliment. This is done by getting the positive form of the number in binary, changing all the 1s to 0s and 0s to 1s then adding 1. e.g.

00101101 = 45
11010011 =-45

Real numbers are produced in binary by using floating point representation. If the number is a fraction a decimal point is put into the binary to represent it, as after the decimal point the numbers go 1/2, 1/4, 1/8 etc. however the computer doesn’t understand decimal points which is where floating point representation is used. The decimal point is moved all the way to the left leaving the binary number without it and calling it the mantissa. The mantissa is then x by 2 to the power of how many places it was moved (exponent).e.g.

mantissa= 00010101 exponent = 5
00010101 x 2^5

To represent text we use ASCII (American standard code for information interchange) which gives each character a unique, 7 bit, binary code. However ascii can only store 128 characters so extended ascii was made. This uses 8 bits to store a character and can store 256 characters. However there are languages that have more that over 256 characters so they cant use this system which is where unicode is used. Unicode uses 2 bytes (16 bits) to store characters. This can store 65536 characters.

Bitmapped graphics – A screen is made up off lots of tiny dots called pixels. Each individual pixel stores colours. The more colours the more bits used to store the colours in each pixel. With more pixels the quality of the image is increased and with more colours in each pixel the finer the detail. Each pixel holds a binary number which represents the colour it holds. with more colours you need more binary numbers so you need to increase the bit size to get bigger numbers. 1 bit only stores 2 colours, black and white. 2 bits 4 colours etc. true colour(the most colours a human can recognise) is 24 bits(3 bytes) which is 16777216 colours.


1 thought on “Data Representation

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s