0.1₁₀ → binary — number base conversion

corenon-terminating in base 2

Answer

0.0(0011) repeating

Why this example is worth doing

One tenth has no finite binary representation: the multiplication cycle repeats forever with period four. This is the arithmetic root of every floating-point surprise a programmer ever meets, and the reason 0.1 + 0.2 is not 0.3 in most languages. The tool detects the cycle exactly using rational arithmetic rather than floating point — computing the repetend in floating point gets it wrong for exactly this value — and marks the repeating block.

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.1 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
1110^-10.10.1
total0.1

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.10.1 × 20.20
0.20.2 × 20.40
0.40.4 × 20.80
0.80.8 × 21.61
0.60.6 × 21.21

0.1 (base 10)0.0(0011) (base 2)

Warning:

The expansion repeats: the digits in brackets recur forever (period 4). Write them under a vinculum on paper.

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