Converting a Bicimal to a Fraction (Subtraction Method)

In my article “Binary Division” I showed how binary long division converts a fraction to a repeating bicimal. In this article, I’ll show you a well-known procedure — what I call the subtraction method — to do the reverse: convert a repeating bicimal to a fraction.

Equivalent Representations of 47/12, in Binary
Equivalent Representations of 47/12, in Binary

Bicimals

A bicimal is the base-two analog of a decimal; it has a bicimal point and bicimal places, and can be terminating or repeating.

A terminating bicimal has a finite number of bicimal places; a repeating bicimal (also known as a recurring bicimal or periodic bicimal) has an infinite number of bicimal places, due to a sequence of digits that repeat forever. There are two types of repeating bicimals: pure repeating (also known as immediate repeating or strictly repeating) and mixed repeating (also known as delayed repeating). In a pure repeating bicimal, the repeating part (also known as the repetend) starts immediately after the bicimal point. In a mixed repeating bicimal, a non-repeating part starts immediately after the bicimal point; it is then followed by a repeating part.

Here are some examples:

  • 0.1101 (a terminating bicimal).
  • 101.01 (a pure repeating bicimal).
  • 11.1110 (a mixed repeating bicimal).

Like decimals, bicimals are created from fractions through long division. Also like decimals, bicimals can be converted back to fractions. You convert a bicimal to a fraction the same way you convert a decimal to a fraction — you just work in binary instead of decimal, and use powers of two instead of powers of ten.

A terminating bicimal is easy to convert to a fraction: the numerator of the resulting fraction is the bicimal itself, treated as an integer; the denominator is 2n, where n is the number of bicimal places. For example, 0.1101 = 1101/24 = 1101/10000 (which in decimal equals 13/16 = 0.8125). (Notice how I mixed decimal and binary numerals. Although potentially confusing, it is common practice, and actually makes things easier. I will be doing this throughout the article.)

Repeating bicimals take more work to convert. There are several methods; I will describe the subtraction method.

Subtraction Method

In the subtraction method, you take a bicimal b and create an expression that subtracts out its repeating part, and then rewrite that expression so that b is expressed as a fraction. Specifically, you create two nonnegative power of two multiples of b, mb and nb, such that mbnb = i, where i is an integer. Using simple algebra, you rewrite this expression as a fraction: b(m-n) = i, or b = i/(m-n).

Here is a straightforward way to pick m and n. Let p be the length of the non-repeating part, and let r be the length of one cycle of the repeating part. Choose m = 2p+r, and choose n = 2p. These values of m and n shift b left by differing numbers of places, creating new bicimals with identical fractional parts but different integer parts. (For pure repeating bicimals, p will be 0 and thus n will be 1, so nb = b; that is, it’s not shifted.)

Examples

Example 1: 101.01 = 10000/11

Consider the pure repeating bicimal b = 101.01. Picking m = 22 = 4 shifts b left by two places, giving 10101.01. Now if we subtract b from that, we will remove the fractional part (leaving b as is means we’ve picked n = 20 = 1). Let’s show the subtraction algebraically, in mixed decimal and binary numerals:

mbnb

4bb = 10101.01 – 101.01

3b = 10000

11b = 10000

b = 10000/11

which in decimal equals 16/3 = 5.3.

Example 2: 11.1110 = 101111/1100

Consider the mixed repeating bicimal b = 11.1110. Picking m = 24 = 16 will shift b left by four places — pulling out the non-repeating part and one cycle of the repeating part — giving 111110.10. Picking n = 22 = 4 will shift a copy of b left by two places — pulling out just the non-repeating part — giving 1111.10. Now let’s do the algebra:

mbnb

16b – 4b = 111110.10 – 1111.10

12b = 101111

1100b = 101111

b = 101111/1100

which in decimal equals 47/12 = 3.916.

Examples Redone Using Only Binary Numerals

You can perform the subtraction method using only binary numerals (thanks James for the comment); I will redo the two examples in this way.

Example 1: 101.01 = 10000/11

mbnb

100bb = 10101.01 – 101.01

11b = 10000

b = 10000/11

Example 2: 11.1110 = 101111/1100

mbnb

10000b – 100b = 111110.10 – 1111.10

1100b = 101111

b = 101111/1100

A Way to Avoid Binary Arithmetic on the Left Hand Side

The binary subtraction on the left hand side of the equation can be avoided; let’s manipulate the left hand side algebraically (remember that m = 2p+r and n = 2p):

mbnb

2p+rb – 2pb

2p(2rbb)

2pb(2r – 1)

(2r – 1)2pb

You don’t need to do any arithmetic to compute (2r – 1)2p: it is a string of r 1s followed by p 0s. For example 1, r = 2 and p = 0 gives 11; for example 2, r = 2 and p = 2 gives 1100.

On Going Directly to a Fraction Written in Binary

If you look around the Web (for example, Wikipedia), you’ll see this procedure is typically used to convert a bicimal straight to a fraction written in decimal numerals. For example 2, the steps would be:

mbnb

16b – 4b = 111110.10 – 1111.10

12b = 47

b = 47/12

which you’d then say is 101111/1100 in binary.

Conceptually, I see the process as bicimal -> fraction written in binary -> fraction written in decimal -> decimal, which is why I prefer my presentation.

Equivalent Representations of 47/12, In Binary and Decimal
Equivalent Representations of 47/12, in Binary and Decimal

Other Methods

Read my articles about the direct method and the series method — two other ways to convert a bicimal to a fraction.

Dingbat

2 comments

  1. Good method! Am I right in saying that this should work in all bases?

    Decimal:
    3.4’83 (apostrophe signifies start of repetend)
    md – nd
    1000d – 10d = 3483.’83 – 34.’83
    990d = 3449
    d = 3449/990
    Correct!

    Dozenal/uncial (0123456789XƐ):
    3.4’83
    mu – nu
    1000u – 10u = 3483.’83 – 34.’83
    ƐƐ0u = 344Ɛ
    u = 344Ɛ/ƐƐ0
    Correct!

    Hexadecimal (0123456789ABCDEF):
    3.4’83
    mx – nx
    1000x – 10x = 3483.’83 – 34.’83
    FF0x = 344F
    x = 344F/FF0
    Correct!

    (Checked on W|A).

  2. @James,

    Yes, it’s good for any base (of course you must have the means — like Wolfram Alpha — to do arithmetic and base conversion in that base).

    You do the method slightly differently than I do. You do the left hand side arithmetic in the non-decimal base. For example, here is your base 12 example (copied here in my formatting):

    munu
    1000u – 10u = 3483.83 – 34.83
    ƐƐ0u = 344Ɛ
    u = 344Ɛ/ƐƐ0

    I would have done it this way (I’m using 123 = 1728 and 121 = 12):

    munu
    1728u – 12u = 3483.83 – 34.83
    1716u = 344Ɛ
    ƐƐ0u = 344Ɛ
    u = 344Ɛ/ƐƐ0

    I think I like your way better: all numerals are in one base, and the required left shifting is more apparent.

    Your examples also highlight the form the denominators take: decimal, 9s followed by 0s; dozenal, Ɛs followed by 0s; hexadecimal, Fs followed by 0s. I will talk about this more in my next article, which will discuss what I call the denominator method direct method.

    As usual, thanks for the comment.

Comments are closed.

Copyright © 2008-2024 Exploring Binary

Privacy policy

Powered by WordPress

css.php