P2 T1 L7 - Floating point numbers Flashcards
What are real numbers? (in the context of computing)
1 point
- In the context of Computing, Real Numbers are numbers with a fractional part.
Real numbers can be stored in ______ point and ______ point.
fixed
floating
Explain fixed point
1 point
- Fixed Point representation (where the point cannot move), they have a pre-determined number of bits before and after the point
Explain floating point
1 point
- Floating Point (where the point does move), you get more accuracy and a larger range of numbers you can represent
Layout of unsigned integer
Integer |
Layout of signed integer
sign | integer |
Layout of unsigned fixed point
integer | fraction |
Layout of signed fixed point
sign | integer | fraction |
Layout of floating point
sign | mantissa | sign | exponent |
(Fixed point)
Has a specific number of bits (or digits) reserved for the ______ part (the part to the left of the decimal point) and a specific number of bits reserved for the _______ part (the part to the right of the decimal point).
No matter how large or small your number is, it will always use the same number of bits for each portion.
Decimal point stays in the same position
Decimal point is not ______ (Does not take up any bit positions)
integer
fractional
stored
__________ is the process of moving the binary point of a floating point number to provide the maximum level of precision for a given number of bits
Normalisation
Why do we do normalisation?
3 points
- To make best use of the available bits
- To prevent a loss of bits causing a loss of accuracy
- Typically used to represent very large or very small numbers by storing a mantissa and an exponent in a 16-bit word (i.e. two bytes) or 32 bit.
What are the rules of normalisation?
3 rules
- Only 1 bit before the decimal point
- DENARY ONLY: the bit before decimal point must be non-zero (e.g. 3.255 * 10^1)
- BINARY ONLY: the bit before the decimal point is the sign (e.g. 0.1101 * 2^3)
What is the exponent?
1 point
- The exponent is used as a multiplier to move the mantissa to the correct ‘size’
Convert the binary floating point number, 01101010, to a decimal, to denary.
(In this example the mantissa has 5 bits and the exponent has 3.)
(5 steps)
- Mantissa = 01101, Exponent = 010
- Insert decimal point (always goes between digits 1 and 2 OR between the sign and the mantissa) = 0.1101
- Exponent is positive (using 2s compliment), denary value = 2
- Move the decimal point 2 places to the right = 011.01
- Fixed point number to denary = 3.25