Computer Arithmetic

Which correctly describes representing decimal 0.1 as a binary floating-point number?

  1. AIt can be represented exactly as 0.1 in binary too, so no error arises
  2. BIt becomes an infinitely repeating binary fraction, so a nearby rounded value is stored
  3. CIn binary, it becomes exactly ten times larger than the original value
Show answer and explanation

Answer: B. It becomes an infinitely repeating binary fraction, so a nearby rounded value is stored

Decimal 0.1 in binary is 0.000110011001100…, with 0011 repeating forever. A floating-point significand has limited digits, so only a nearby rounded value can be stored, introducing a small error. Any number whose denominator in lowest terms is not a power of two cannot be written in finitely many binary digits, whereas numbers such as 0.5 and 0.25 are exact. No conversion makes the value ten times larger.

  • A. 0.1 cannot be written with finitely many binary digits.
  • B. Correct. It becomes a repeating binary fraction, so a rounded value is stored.
  • C. No conversion multiplies the value by ten.

Related calculators

Books on Computer Arithmetic Ad

As an Amazon Associate I earn from qualifying purchases.

More Computer Arithmetic questions

  1. In many programming languages, why is the double-precision comparison 0.1 + 0.2 == 0.3 false?
  2. What is the machine epsilon (the gap between 1 and the next larger representable number) in IEEE 754 single precision?
  3. Which gives the approximate number of reliable decimal digits for single and double precision?
  4. What is the role of IEEE 754 subnormal numbers?
  5. On some processors, computations involving many subnormal numbers can slow down dramatically. Which setting is used when performance takes priority?

Comparisons in this topic