13.3 Floating-point numbers, representation and manipulation Flashcards
What is floating point notation?
Floating-point notation is a way of representing very small or very large numbers with the same amount of bits.
What are the three parts that a floating point consists of?
sign bit
mantissa
exponenet
How do you find the value of the number?
Using ±M x 2^E
where ± is determined by the sign bit, M is the mantissa, and E is the exponent.
What happens if more bits are allocated to the mantissa then the exponent?
the floating-point value is more precise
What happens if more bits are allocated to the exponent then the mantissa?
the floating-point system could represent a greater range of values.
What is normalisation?
Normalisation is the process of choosing the floating-point representation of a number such that every number that can be represented in the floating-point system has one and only one valid representation.
What happens if there is no normalisation?
there could be multiple valid representations for the same number.
What are the floating point errors?
Underflow
Overflow
Rounding erros
What is underflow?
Underflow is where the number is too small to be represented using the floating-point system.
Example of underflow?
e.g. In a system with 8 bits for the mantissa and 4 bits for the exponent, the lowest possible exponent is 1000, or -8 in denary. If the system is normalised, the smallest positive mantissa value is 0 1000000. Thus, the smallest positive number in this system is 0 1000000 1000, which is equal to 1/512. If a calculation in this system resulted in a number which was lower than 1/512, there would be an underflow error, because the number is too small to be stored.
What is overflow?
Overflow is similar to underflow, but it occurs when a number is too large to be stored in the system.
Example of overflow?
e.g. In a system with an 8-bit mantissa and a 4-bit exponent, the largest possible number that can be represented is 0 1111111 0111, which is equal to 127. If a calculation produced a number higher than 127, there would be an overflow error and the number could not be stored.
Overflow and underflow can both occur with negative values that are too large or too small.
What is a rounding error?
A rounding error is where a number cannot be represented exactly, and needs to be approximated.
Example of rounding error?
e.g. The number 1/3 can only be represented in binary using recurring bits (0.0101). The floating-point format does not allow for recurring bits as there is only a finite amount of memory in the system. Thus, it needs to be rounded, so it will be represented as 0 1010101 1111.