Questions: Floating Point Representation

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A programmer writes `if (0.1 + 0.2 == 0.3)` in a language using IEEE 754 double precision. What will happen, and why?

AThe condition evaluates to true — 0.1 + 0.2 equals 0.3 exactly in double precision
BThe condition evaluates to false — neither 0.1 nor 0.2 has an exact binary representation, so their sum differs slightly from the stored value of 0.3
CThe condition evaluates to true only on CPUs with a hardware floating-point unit
DThe expression raises an overflow exception since 0.3 cannot be represented
Question 2 Multiple Choice

Why does IEEE 754 floating point maintain approximately the same number of significant decimal digits across its entire representable range — whether storing a number near 10⁻³⁰⁰ or near 10³⁰⁰?

ABecause the hardware allocates more mantissa bits to smaller numbers to compensate for their tiny magnitude
BBecause relative precision — bounded by machine epsilon — is constant regardless of magnitude
CBecause the exponent bits grow larger as the number grows, maintaining absolute error
DBecause the mantissa is stored in decimal form internally, independent of the binary exponent
Question 3 True / False

The decimal number 0.1 cannot be represented exactly in IEEE 754 binary floating point because it requires an infinitely repeating binary fraction.

TTrue
FFalse
Question 4 True / False

Floating-point arithmetic errors are unpredictable and random, so numerical analysts cannot systematically bound or control their effect on a computation.

TTrue
FFalse
Question 5 Short Answer

Explain why floating point uses relative precision rather than absolute precision, and what practical consequence this has for comparing floating-point numbers for equality.

Think about your answer, then reveal below.