4.5 Fundamentals of data representation Flashcards
(89 cards)
What are natural numbers
whole numbers including zero
what are ordinal numbers
they are integers which describe the numerical position of an object in relation to others eg 1st
what is a bit
it is a fundamental binary digit of either 0 or 1
how many values can be represented with n bits and whats the max value
2^n different values , 2^n - 1 is the max value
how to multiply two unsigned binary
write out the first number, and then write out the second number under each occurrence of a 1 in the first number so the least significant bit is aligned, then perform binary addition excluding the first number
how does two’s complement work to represent negative numbers too
the most significant bit is given as a negative place value
how to subtract numbers in binary
convert values to twos complement with the second number being the negative value and then add the numbers
what is the range when using twos complement and n bits
from - 2^(n-1) to 2^(n-1) - 1
what are the two parts of a floating point binary
the first part is the mantissa and the second part is the exponent
why both fixed point and floating point representation of decimal numbers may be inaccurate
for a real number to be represented by the binary number system it must be capable of being represented by a binary fraction in the given number of bits
how to calculate the absolute error of numerical data
absolute error is the actual amount by which a value is inaccurate
given value - actual value
how to calculate the relative error of numerical data
relative error is a measure of uncertainty compared to the actual value
absolute error / actual value
compare absolute and relative errors for large and small magnitude numbers
an absolute error will have different relative errors depending on the magnitude of the actual value as a big value will have a small relative error whereas a small value will have a big relative error
what does a large mantissa and small exponent mean for the range and precision
small range, good precision
what does a small mantissa and large exponent mean for the range and precision
large range, little precision
what does a placement of the binary point to the left in fixed point mean for the range and precision
small range, good precision
what does a placement of the binary point to the right in fixed point mean for the range and precision
large range, little precision
advantage of floating point over fixed point
a much wider range of numbers can be produced with the same number
of bits as the fixed point system
advantage of fixed point over floating point
The values are handled in the same way as decimal values the processing is faster as there is no processing required to move the
binary point.
The absolute error will always be the same, whereas with floating point
numbers the absolute error could vary
It is suited to applications where speed is more important that precision
What is the purpose of normalisation
ensures that numbers are
represented as precise as possible in relation to how many bits are
being used and that there is only one
representation of a number possible
how to normalise numbers
a normalised positive
floating point number must start 0.1 and a normalised negative floating
point number must start 1.0 - then adjust the exponent with the digits shifted
when does underflow occur
when the number is too small to
be represented with the number of bits allocated
when does overflow occur
when the number is too large to
be represented with the number of bits allocated
consequences of underflow and overflow errors
It could generate erroneous results or even cause the program
to crash