4.5 - Fundamentals of data representation Flashcards
What are natural numbers?
All positive whole numbers and zero.
What are integers?
All whole numbers, positive and negative, and zero.
What are rational numbers?
Any number that can be expressed as a fraction, including 0.
What are irrational numbers?
Numbers that cannot be written exactly as a fraction.
What are real numbers?
All possible quantities, including irrational, rational, integers and natural.
What are ordinal numbers?
Integers used to describe numerical positions of objects in relation to others, e.g. 1st, 2nd or 3rd
How do you convert from binary to hex?
Split the binary number into groups of four bits. Convert each group into decimal, then each decimal value into hex.
How do you convert from hex to decimal?
Split the hex digits, convert them into decimal, convert each decimal value into binary nibbles, then combine the binary nibbles into one binary number, and finally convert to decimal.
How many bits in a byte?
8 bits
How many bytes in a kilobyte?
10^3 bytes
How many bytes in a megabyte?
10^6 bytes
How many bytes in a gigabyte?
10^9 bytes
How many bytes in a terabyte?
10^12 bytes
How many bytes in a kibibyte?
2^10 bytes
How many bytes in a mebibyte?
2^20 bytes
How many bytes in a gibibyte?
2^30 bytes
How many bytes in a tebibyte?
2^40 bytes
Rules for adding binary numbers
0 + 0 = 0
0 + 1 = 1
1 + 1 = 10
1 + 1 + 1 = 11
How do you multiply binary numbers?
Use one number as a guide. Write out the second number under each occurrence of a 1 in the guide number, aligning the rightmost bit with the 1. Then perform binary addition.
How do you subtract binary numbers?
Perform addition with a two’s complement number (adding a negative number).
How do you normalise a floating point mantissa?
Positive:
Find out how many places to the right or left you need to move the decimal point so that there is a 0 on the left and a 1 on the right. Discard any leading 0s, pad the right hand side with 0s, and change the value of the exponent so that the final value is the same.
Negative:
Find out how many places to the right or left you need to move the decimal point so that there is a 1 on the left and a 0 on the right. Discard any leading 1s, then pad the right hand side with 0s, and change the value of the exponent so that the final value is the same.
Why must floating point numbers be normalised?
In order to provide the maximum level of precision for a given number of bits.
What are rounding errors?
Some decimal numbers cannot possibly be represented exactly in binary, such as 1/3 (0.3333…) - they can only be approximately represented.
There are many numbers that binary cannot accurately represent, such as 0.1. So fixed and floating point numbers may be inaccurate.