0.625₁₀ → binary — number base conversion

coreterminating fraction

Answer

0.101

Why this example is worth doing

Fractions convert by repeated multiplication by two, taking the integer part of each product as the next bit — the mirror of the repeated-division method for integers, and a genuinely different procedure that many courses skip. This value terminates after three bits because its denominator is a power of two. The next example shows what happens when it is not, and the pair is the point.

Try your own input in the Binary ⇄ decimal ⇄ hex ⇄ octal. Convert between any two bases, integers and fractions, with the positional working.

How the answer is reached

Base 10 to base 2

Convert 0.625 from base 10 to base 2. The sign is carried across unchanged; only the magnitude is converted.

Positional expansion of the input — Base 10 to base 2
digitvalueweightweight (base 10)digit x weight
0010^010
6610^-10.10.6
2210^-20.010.02
5510^-30.0010.005
total0.625

Integer part: divide by 2 and read the remainders bottom to top.

Read the last column bottom to top. ↑ — Base 10 to base 2
ndivide byquotientremainder
00 ÷ 200

Fraction part: multiply by 2 and read the digits top to bottom.

Read the last column top to bottom. ↓ — Base 10 to base 2
fractionmultiply byproductdigit
0.6250.625 × 21.251
0.250.25 × 20.50
0.50.5 × 211

0.625 (base 10)0.101 (base 2)

Compare with

Open this example in the Binary ⇄ decimal ⇄ hex ⇄ octal

The field arrives filled in with this example’s input.

Note:

Notation this page assumes

  • Bit strings are written most significant bit first, and bit 0 is the least significant bit.
  • A width is stated explicitly wherever it changes the answer; nothing is silently sign-extended or truncated.
  • Fractions are converted digit by digit and shown to a stated number of places rather than rounded silently.

Sources

  • Knuth, The Art of Computer Programming, Vol. 2, §4.1 “Positional Number Systems” (1997)
  • IEEE 754-2019, Standard for Floating-Point Arithmetic