Understanding Binary Fractions

A binary fraction expresses a value smaller than one using powers of two as the denominator. Where decimal fractions use powers of 10 (0.42 = 42/100), binary fractions use powers of 2 (0.101₂ = 1/2 + 0/4 + 1/8).

Converting whole numbers between decimal and binary is straightforward and error-free. The fractional part is trickier. A decimal number like 0.3 has a finite representation in base 10 but requires infinite digits in base 2—meaning you must truncate or round, introducing unavoidable error.

This limitation affects every digital system. When a computer stores 0.1 in floating-point format, it's actually storing an approximation, which is why comparing decimal numbers in code requires tolerance thresholds rather than equality checks.

Converting Decimal to Binary Fractions

Multiply the decimal fraction by 2 repeatedly. Each time, the integer part of the result becomes your next binary digit. Remove that integer part and continue with the remaining fraction until you reach zero or your desired precision.

Decimal × 2 → Extract integer part → Binary digit

Remove integer, multiply remainder × 2 → Next binary digit

  • Decimal fraction — The fractional part of a number in base 10 (values between 0 and 1)
  • Binary digit — Either 0 or 1, representing the integer part after multiplication by 2
  • Precision — Number of binary digits to compute before stopping

Converting Binary to Decimal Fractions

Each position in a binary fraction corresponds to a negative power of two. Sum the contributions of each '1' digit: position 1 = 2⁻¹, position 2 = 2⁻², position 3 = 2⁻³, and so on.

0.b₁b₂b₃... = b₁×(1/2) + b₂×(1/4) + b₃×(1/8) + ...

Example: 0.1101₂ = (1×1/2) + (1×1/4) + (0×1/8) + (1×1/16) = 0.8125

  • b₁, b₂, b₃... — Binary digits (0 or 1) at each position after the point
  • Decimal value — The sum of all weighted contributions

Why Binary Fractions Have Limits

Only fractions whose denominator is a power of 2 convert exactly to finite binary representations. Examples: 1/2 = 0.1₂, 3/4 = 0.11₂, 5/8 = 0.101₂.

Fractions like 1/3, 1/5, or 0.1 in decimal have infinite, non-repeating binary expansions. Computers truncate these after a fixed number of bits, creating rounding error. The more digits you use, the smaller the error—but it never vanishes entirely.

This is why 0.1 + 0.2 ≠ 0.3 in floating-point arithmetic. Both 0.1 and 0.2 are approximations, and their sum accumulates rounding error differently than converting 0.3 directly. Programmers compensate by using epsilon comparisons or fixed-point arithmetic for financial calculations.

Common Pitfalls When Working with Binary Fractions

Avoid these mistakes when converting or using binary fractional representations.

  1. Assuming all decimals convert exactly — Not every finite decimal converts to a finite binary fraction. 0.1, 0.2, 0.3, 0.7—none of these have exact binary equivalents. Always allow for rounding error in simulations or calculations that depend on precision.
  2. Confusing truncation with rounding — This calculator truncates (cuts off) rather than rounds. 0.0110 truncated is 0.011, not 0.0110 rounded to 0.0111. Truncation can accumulate larger errors, especially in iterative algorithms.
  3. Overlooking denominator factorization — Before converting, factor the denominator. If it only has factors of 2, the binary conversion will be exact. If it contains other primes (3, 5, 7...), expect infinite binary digits. This quick check saves time debugging precision issues.
  4. Ignoring bit-representation limits in hardware — Real computers use fixed-size storage (32-bit, 64-bit). A binary fraction that fits in 32 bits but requires 48 to represent accurately will silently lose precision when stored. Always verify your hardware's floating-point precision for your application.

Practical Uses and Applications

Binary fraction conversion matters in graphics programming (where sub-pixel precision is critical), signal processing (where frequency components are often represented as fractions of 2π), and audio (sample rates and bit depths rely on powers of 2).

Understanding binary fractions also explains why certain numbers are

Frequently Asked Questions

Why doesn't 0.1 + 0.2 equal 0.3 in programming languages?

Both 0.1 and 0.2 require infinite binary digits, so they're stored as approximations. When you add these approximations, the rounding errors combine in unexpected ways. The sum is actually something like 0.30000000000000004 in languages like JavaScript. This isn't a bug—it's a consequence of using fixed-width binary storage for numbers that don't have finite binary representations.

Can I represent any fraction in binary if I use enough digits?

Not perfectly. You can get arbitrarily close by using more digits, but fractions like 1/3 or 1/5 truly have infinite, non-repeating binary expansions. There's no finite number of bits that captures them exactly. The error shrinks logarithmically: each additional bit roughly halves the error magnitude. For practical purposes, 32 or 64 bits provide sufficient precision for most applications.

Which fractions convert to finite binary representations?

Only those whose reduced denominator is a power of 2. For example: 1/2, 3/4, 7/8, 15/16 all convert finitely. Any fraction where the denominator has prime factors other than 2 (such as 1/3, 1/5, 1/10) will have infinite binary digits. You can quickly check by factoring the denominator—if you see only 2s, it's finite in binary.

What's the difference between rounding and truncation in binary conversion?

Truncation simply cuts off digits at your desired precision, discarding everything beyond. Rounding adjusts the last kept digit based on what follows. Truncation is simpler to implement but usually introduces larger error. For example, 0.1111₂ truncated to 3 digits is 0.111₂, while rounded it would be 1.000₂. Most calculators truncate for clarity, but financial systems often round to minimize bias.

How do computers store decimal numbers like 0.5 in memory?

0.5 is one of the lucky decimals with a finite binary representation: 0.1₂. The computer stores the binary fraction along with exponent and sign information (following standards like IEEE 754). Numbers with finite binary representations are stored exactly. Others are approximated, which is why 0.1 is never truly 0.1 in a computer—it's the closest representable value, typically something like 0.100000000000000005551115...

More math calculators (see all)