binary

How do you convert a fraction to binary?


1/10(decimal) = 0.0001100110011... (binary)

How do I do that? Am I supposed to convert to binary and then divide? Could someone show me?


Solution

  • In university I learned it this way:

    1. Multiply by two
    2. take decimal as the digit
    3. take the fraction as the starting point for the next step
    4. repeat until you either get to 0 or a periodic number
    5. read the number starting from the top - the first result is the first digit after the comma

    Example:

    0.1 * 2 = 0.2 -> 0
    0.2 * 2 = 0.4 -> 0
    0.4 * 2 = 0.8 -> 0
    0.8 * 2 = 1.6 -> 1
    0.6 * 2 = 1.2 -> 1
    0.2 * 2 = 0.4 -> 0
    0.4 * 2 = 0.8 -> 0
    0.8 * 2 = 1.6 -> 1
    0.6 * 2 = 1.2 -> 1
    Result: 0.00011(0011) periodic.