Checking whether a reduced fraction has a finite binary expansion
Decide whether a fraction can be written with finitely many binary places by reducing it and looking at the denominator.
What a binary place is worth
Digits after a binary point carry weights of one half, one quarter, one eighth, one sixteenth and so on, each the previous weight divided by two. Any finite string of these digits adds up to a fraction whose denominator is a power of two. The string 0.011 means 0 halves, 1 quarter and 1 eighth, which is 1/4 plus 1/8, or 3/8. The fraction calculator confirms the addition: 1/4 plus 1/8 gives numerator 3 and denominator 8. This is the reason for the test in this guide. Only fractions that can be rewritten with a power of two in the denominator have a binary expansion that stops, and every other fraction needs a repeating pattern.
Reduce first, then read the denominator
The test is applied after the fraction is in lowest terms. A fraction like 6/16 looks like it has the denominator 16, a power of two, and reducing it to 3/8 keeps that. A fraction like 3/12 has the denominator 12, which contains a factor of 3, but reduction gives 1/4, and the factor disappears. The check fails only when a prime other than 2 remains in the denominator after cancelling. Using the fraction calculator, 1/12 plus 1/6 returns numerator 1 and denominator 4, showing a case that looks awkward at the start and lands on a power of two after reduction. Skipping the reduction step gives wrong answers in both directions.
Three eighths against one tenth
The guide contrasts 3/8 with 1/10. The first has denominator 8, which is 2 cubed, so it terminates in binary as 0.011. The second has denominator 10, which is 2 times 5, and the factor 5 never reduces away because the numerator is 1. No sum of halves, quarters, eighths and so on can equal one tenth in a finite number of terms. Its binary expansion begins 0.0001100110011 and repeats the block 0011 forever. The decimal side is different, since the basic calculator gives 3 divided by 8 as 0.375, a terminating decimal. A fraction terminates in decimal when its reduced denominator has only the primes 2 and 5, and in binary only when it has only the prime 2.
Another terminating case, five sixteenths
Consider 5/16. The denominator is 2 to the fourth, so the binary expansion has at most four places. Writing 5/16 as 1/4 plus 1/16 gives binary 0.0101, since the quarter place and the sixteenth place are the ones set. The fraction calculator returns numerator 5 and denominator 16 for 1/4 plus 1/16, and the basic calculator gives 5 divided by 16 as 0.3125. The number of binary places needed equals the exponent of 2 in the reduced denominator, here 4, while the decimal expansion needs the same number of places because 16 is a power of 2 and 5 never appears. Here both decimal and binary stop after four digits.
Why computers round a tenth
Most programming languages store ordinary decimals as binary floating point numbers with a fixed number of bits. A value such as 0.1 has no finite binary expansion, so the stored number is the nearest representable value, which is slightly larger than one tenth, about 0.1000000000000000055511 in the common 64-bit format. This is the origin of familiar results like 0.1 plus 0.2 not displaying as exactly 0.3 in many languages. Fractions with power-of-two denominators, such as 0.5, 0.25 and 0.375, are stored without error. The rule from this guide predicts which decimals are safe: reduce the fraction and check for a denominator that is a power of two.
The integer converter does not handle radix points
The Integer Base Converter on this site converts whole-number strings between bases 2 and 36. It does not accept a radix point, so it cannot turn 0.011 into 0.375 or back. To work with a fractional binary value, convert the numerator and denominator separately as integers, or handle the binary places by the weights described above. For example, 011 as an integer in base 2 is 3, and the third binary place has weight 1/8, so the fraction is 3/8. Keeping the integer converter for integer inputs avoids false confidence from a tool that was never designed for fractional digits.
Stating precision for approximations
A repeating binary fraction can still be used in practice when the precision is stated. Rounding 1/10 to 10 binary places gives a value within about one in 2,048 of the true number, and more places tighten that bound. The guide also separates the exact fraction from any rounded display. When reporting a result, say whether a value is exact, as 3/8 is, or an approximation with a stated number of places. Treating an approximation as exact is the usual cause of equality tests that fail in software, and calling a terminating value approximate understates what is known. Check the reduced denominator first, then decide which kind of statement the result supports.
Reading binary places from a fraction
To find the binary digits of a terminating fraction, repeatedly double it. Take 3/8. Doubling gives 6/8, which is below 1, so the first digit is 0. Doubling 6/8 gives 12/8, which is 1 with 4/8 left, so the second digit is 1. Doubling 4/8 gives 8/8, which is 1 with nothing left, so the third digit is 1. The digits 0, 1, 1 read 0.011, and the process stopped because the remainder reached zero. Run the same procedure on 1/10 and the remainders cycle through 2/10, 4/10, 8/10, 6/10 and back, so the process never ends. The doubling method therefore also detects repetition: a remainder that returns means the expansion repeats.
Where finite binary fractions matter
Audio and graphics code often uses values such as 0.5, 0.25 and 0.125 because they are exact in binary, and scaling by powers of two is cheap in hardware. Money is different: cents are hundredths, and one hundredth has a factor of five in its denominator, so values like 0.01 and 0.10 cannot be stored exactly as binary fractions. That is why financial software commonly stores amounts as integer cents or uses decimal arithmetic types. A price of 0.75, by contrast, is 3/4 and is exact in binary, which shows that the rule depends on the value and not on how many decimal digits it has. The test in this guide explains the rule underneath those choices. Reduce the fraction, look at the denominator, and ask whether only the prime 2 remains.
Reproduce the checks
Three eighths as a fraction
Open the Fraction calculator and enter:
- First numerator
1- First denominator
4- Operation
add- Second numerator
1- Second denominator
8
Expected output:
Result numerator
3Result denominator
8The binary places sum exactly to three eighths.
Exact decimal value of three eighths
Open the Basic calculator and enter:
- First number
3- Operation
divide- Second number
8
Expected output:
Result
0.375The same rational value terminates in decimal as well.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.