Section 6: Data types Flashcards
What is a fixed point binary number?
A fixed point binary number is a binary number with a binary point that allows you to represent decimals with binary.
How does the placement of a binary point affect the range and precision of the number?
The further to the right the binary point is, the higher the range and the lower the precision.
What is a floating point binary number?
A floating point binary number is a representation of a binary number involving a mantissa and an exponent that allows you to represent very high numbers.
How do you convert a floating point binary number to denary?
- Translate the exponent from binary to denary e.g. 0011 = 3
- Move the decimal point to the right by the same number as the exponent (if exponent is negative, move to the left)
- Translate the new binary number to denary
How do you convert a floating point number with a negative mantissa to denary?
You find the two’s compliment of the mantissa then complete the rest of the steps as normal (remembering there is a minus sign at the beginning).
What is normalisation?
Normalisation is the process of moving the binary point of a floating number to provide the maximum level of precision for a given number of bits.
How is a positive normalised floating point binary number represented?
A positive normalised floating point binary number has a sign bit of 0 and the next digit is always 1.
How do you normalise a positive floating point binary number?
- Move the binary point to the right until there is a 1 after the sign bit e.g. by 3 places
- Since the mantissa has become larger, the exponent needs to be made smaller so you would subtract the number of places the binary point has moved from the exponent (e.g. subtract 3)
How is a negative normalised floating point binary number represented?
A negative normalised floating point binary number has a sign bit of 1 and the next bit is always 0.
How do you normalise a negative floating point binary number?
- Move the binary point to the right until there is a 0 after the sign bit
- Take the amount of places that you shifted the binary point by from the exponent (e.g. shift 3 places, take 3 from the exponent)
How do you convert from denary to a normalised floating point binary number?
- Convert the denary number to a fixed point binary number
- Move the binary point so that it is in a normalised format
- Change the exponent to match how you have changed the binary point (e.g. if you move it 3 to the left, exponent becomes 3 from 0)
How do you add/subtract floating point numbers?
- Line up the points by making the exponents equal
- Add or subtract the mantissas
- Normalise the result
In a logical right shift, which bit is replaced (and what with?)
In a logical right shift, the most significant bit is replaced by a 0 and the least significant bit moves into the carry bit.
In a logical left shift, which bit is replaced (and what with?)
In a logical left shift, the least significant bit is replaced by a 0 and the most significant bit moves into the carry bit.
What is the key difference between a logical shift and an arithmetic shift?
The key difference between a logical shift and an arithmetic shift is that an arithmetic shift keeps the sign bit constant.