Floating-point Numbers, Representation & Manipulation (Cambridge (CIE) A Level Computer Science): Flashcards

Exam code: 9618

1/67

0Still learning

Know0

Cards in this collection (67)

  • Define floating-point binary.

    Floating-point binary represents real numbers in binary: numbers with a fractional part, and numbers that are very large or very small.

  • What is floating-point binary equivalent to in denary?

    It works like scientific notation, but in base 2.

  • How is a floating-point number written?

    As a mantissa multiplied by 2 to the power of an exponent.

  • In 3140 = 3.14 x 10^3, which part is the mantissa and which is the exponent?

    3.14 is the mantissa, the significant digits. 3 is the exponent, how far to move the decimal point.

  • Give two reasons to use floating-point representation.

    It represents a much wider range of numbers than fixed-point using the same number of bits, and the binary point can float, giving good precision for fractional values.

  • Define mantissa.

    The mantissa holds the significant bits of the number. It is a two's complement number with the binary point immediately after the leftmost bit.

  • In the mantissa, the binary point sits immediately after the                  bit.

    In the mantissa, the binary point sits immediately after the leftmost bit.

  • Define exponent.

    The exponent is how many places to move the binary point, positive to move right and negative to move left. It is also stored in two's complement.

  • Which parts of a floating-point number are stored in two's complement?

    Both the mantissa and the exponent.

  • What does the leftmost bit of the mantissa act as?

    The sign: 0 means positive and 1 means negative.

  • Convert +6.25 to a 12-bit mantissa and a 4-bit exponent.

    6.25 = 110.01, normalised to 0.11001 x 2^3. Mantissa 011001000000, exponent 0011.

  • How do you find the mantissa of a negative floating-point number?

    Work out the positive mantissa first, then take its two's complement by flipping the bits and adding 1.

  • True or False?

    To make a floating-point number negative you just change the sign bit.

    False.

    You must take the two's complement of the whole positive mantissa. Changing only the sign bit loses every mark on the conversion.

  • The 12-bit mantissa for +6.25 is 011001000000.

    What is the mantissa for -6.25?

    Flip the bits to 100110111111, then add 1, giving 100111000000.

  • Define normalisation of a floating-point number.

    A floating-point number is normalised when the first two bits of the mantissa are different.

  • What do the first two bits of a normalised number look like?

    01 for a positive number, and 10 for a negative number.

  • True or False?

    A normalised negative number starts 11.

    False.

    A normalised negative number starts 10. If it starts 11 it is not normalised, or sign-and-magnitude has been used by mistake.

  • Why does normalising improve precision?

    Removing leading zeros means the mantissa uses all of its bits for significant figures, giving the most accurate value possible for that number of bits.

  • Why does normalising give uniqueness?

    Each number has exactly one normalised form, which makes comparison and arithmetic simpler.

  • How do you adjust the exponent when normalising?

    If the point moves left, increase the exponent. If the point moves right, decrease the exponent.

  • When normalising, if the binary point moves left you                  the exponent.

    When normalising, if the binary point moves left you increase the exponent.

  • Normalise the mantissa 0.0011 with exponent +2.

    Move the point 2 places right so the mantissa becomes 0.1100, and decrease the exponent by 2 to 0. The value is unchanged.

  • How should the normalised form be written for CIE?

    As 0.xxxxx x 2^n, not 1.xxxxx x 2^n, which is the IEEE form.

  • What is the first step in converting denary to floating-point binary?

    Convert the magnitude to binary, both the integer part and the fractional part.

  • Convert 5.25 to binary.

    5 = 101 and 0.25 = 0.01, so 5.25 = 101.01.

  • What is the second step in converting denary to floating-point binary?

    Normalise into the form 0.xxxxx x 2^n, moving the binary point until the first two bits differ.

  • What does the number of places the binary point moves give you?

    The exponent.

  • Normalise 101.01.

    0.10101 x 2^3

  • How do you build the positive mantissa?

    Write 0, then the fraction bits, then pad with zeros on the right.

  • Give the 12-bit mantissa and 4-bit exponent for +5.25.

    Mantissa 010101000000, exponent 0011.

  • The exponent is converted to            complement in the required number of bits.

    The exponent is converted to two's complement in the required number of bits.

  • What extra step is needed if the number is negative?

    Take the two's complement of the whole positive mantissa, by flipping the bits and adding 1.

  • The 12-bit mantissa for +5.25 is 010101000000.

    Give the mantissa for -5.25.

    Flip the bits to 101010111111, then add 1, giving 101011000000.

  • Does the exponent change when the number becomes negative?

    No. The exponent is unchanged.

  • How can you check that a negative mantissa is normalised?

    It should begin 10.

  • What is the first step in converting floating-point binary to denary?

    Read the exponent and convert it from two's complement to denary.

  • How do you tell the sign of a floating-point number?

    Check the first bit of the mantissa: 0 means positive, 1 means negative.

  • What do you do if the mantissa is negative?

    Take its two's complement to find the magnitude of the fraction, then make the final answer negative.

  • To convert a negative mantissa to its magnitude, flip the bits and add         .

    To convert a negative mantissa to its magnitude, flip the bits and add 1.

  • How do you apply the exponent?

    Move the binary point: right if the exponent is positive, left if it is negative.

  • True or False?

    Only the mantissa is stored in two's complement.

    False.

    Both the mantissa and the exponent are stored in two's complement.

  • Convert mantissa 010101000000, exponent 0011 to denary.

    Exponent is +3. First bit is 0, so positive. Fraction is 0.10101, and 0.10101 x 2^3 = 101.01, which is +5.25.

  • Convert mantissa 101011000000, exponent 0011 to denary.

    First bit is 1, so negative. Two's complement gives 010101000000, a fraction of 0.10101. 0.10101 x 2^3 = 5.25, so the answer is -5.25.

  • Using the place-value check, what does the mantissa 1.01011 equal?

    The leftmost bit carries a negative place value, so -1 + 0.34375 = -0.65625. With an exponent of 3 that gives x 2^3 = -5.25.

  • Convert 113.75 to binary.

    1110001.11

  • Normalise 113.75 and give the exponent.

    0.111000111 x 2^7, so the binary point moves 7 places and the exponent is 7.

  • Give 113.75 with a 10-bit mantissa and a 6-bit exponent.

    Mantissa 0111000111, exponent 000111.

  • Give 113.75 with an 8-bit mantissa and an 8-bit exponent.

    Mantissa 01110001, exponent 00000111. The mantissa is truncated to 8 bits, losing precision.

  • True or False?

    A shorter mantissa stores the same value just as accurately.

    False.

    With fewer bits the mantissa is truncated, which loses precision.

  • Why can real numbers not always be represented exactly in floating-point?

    Floating-point binary has a limited number of bits for the mantissa and exponent, so many numbers can only be approximated.

  • True or False?

    All real numbers can be stored exactly in floating-point binary.

    False.

    Not all real numbers can be represented exactly, only approximated.

  • Give an example of a decimal that cannot be represented precisely in binary.

    0.1, which in binary is 0.000110011001100... recurring.

  • What happens to a recurring binary value when memory is limited?

    It must be truncated or rounded, which introduces small errors.

  • Define rounding error.

    A rounding error is a slight inaccuracy caused when a real number cannot be exactly represented in binary.

  • What is the consequence of rounding errors in a long calculation?

    Calculations using approximated values may accumulate errors, so final results may be slightly inaccurate.

  • Define underflow.

    Underflow occurs when a number is too close to zero to be stored in the available number of bits.

  • Underflow occurs when a number is too close to          to be stored.

    Underflow occurs when a number is too close to zero to be stored.

  • What causes underflow, in terms of the exponent?

    The exponent is too negative to be stored.

  • What is a number stored as if underflow occurs?

    It is stored as 0, which is a loss of precision.

  • A very small number such as 1.2 x 10^-40 causes                     , because its exponent is too negative to store.

    A very small number such as 1.2 x 10^-40 causes underflow, because its exponent is too negative to store.

  • Define overflow.

    Overflow occurs when a number is too large to fit in the allocated bits for the exponent or mantissa.

  • What causes overflow, in terms of the exponent?

    The exponent is too positive to be stored.

  • A calculation produces 1.2 x 1050, but the maximum representable number is 1.2 x 1038.

    What has occurred?

    Overflow.

  • What are the consequences of overflow?

    The program may crash or return an infinity, an error, or a wraparound value.

  • True or False?

    Underflow causes a program to crash.

    False.

    Underflow stores the value as 0, causing a loss of precision. It is overflow that may crash the program or return an error.

  • What is the difference between underflow and overflow?

    Underflow is a number too small to store, which becomes 0. Overflow is a number too large to store, giving an incorrect result or a program error.

  • Where are underflow and overflow especially dangerous?

    Underflow can affect accuracy in scientific or financial calculations. Overflow is especially dangerous in loops or financial applications.

Sign up to unlock flashcards

or