Exhaustive Guide to Base Conversions and Binary Arithmetic Logic

Number Systems and Base Representation

  • Number system conversions cover transformations between Base 1010 (Decimal), Base 22 (Binary), Base 88 (Octal), and Base 1616 (Hexadecimal).

  • Octal system characteristics:

    • Base 88 number system.

    • Valid digits range from 00 to 77 (00 to base −1- 1).

    • Place values represent powers of 88 around the octal point.

    • Place values to the left of the octal point: 80=18^0 = 1 (ones place), 81=88^1 = 8 (eights place), 82=648^2 = 64 (sixty-fours place), 83=5128^3 = 512 (five-hundred-twelfths place).

    • Place values to the right of the octal point: 8−1=18=0.1258^{-1} = \frac{1}{8} = 0.125 (eighths place), 8−2=1648^{-2} = \frac{1}{64} (sixty-fourths place), 8−3=15128^{-3} = \frac{1}{512} (five-hundred-twelfths place).

  • Hexadecimal system characteristics:

    • Base 1616 number system.

    • Valid digits range from 00 to 1515 (00 to base −1- 1).

    • Digits 1010 through 1515 require single-character symbols to avoid multi-digit ambiguity.

    • Hexadecimal digit mappings:

    • 10=A10 = A

    • 11=B11 = B

    • 12=C12 = C

    • 13=D13 = D

    • 14=E14 = E

    • 15=F15 = F

    • Historical proposal for hex notation: A line-segment symbol representing binary bits where distinct line positions signify the 11's, 22's, 44's, and 88's places (e.g., combining lines for 44 and 22 forms 66; all lines present forms 1515).

    • Practical computing context:

    • Hexadecimal is extensively used in displaying system memory locations and diagnostic crash screens such as the Windows Blue Screen of Death (BSOD).

    • An 88-digit hexadecimal memory address represents 3232 binary bits, typical of 3232-bit operating systems like Windows XP.

    • A 1616-digit hexadecimal memory address represents 6464 binary bits, standard in 6464-bit operating systems.

    • Common programming prefixes: 0x denotes hexadecimal numbers, 0b denotes binary numbers, and 0o or 0c denotes octal numbers.

Base 10 to Octal and Octal to Base 10 Conversions

  • Algorithm for converting whole numbers from Base 1010 to Octal (Base 88):

    • Perform repeated long division on the integer portion by the target base (88).

    • Dividing by 88 shifts the octal point one position to the left, isolating the lowest place value as a remainder.

    • The remainder of each division step yields the next octal digit, moving from least significant bit (808^0) to most significant bit.

    • Integer division algorithm applied to 92710927_{10}:

    • 927÷8=115927 \div 8 = 115 with a remainder of 77 (927−8×115=7927 - 8 \times 115 = 7). Digit for 808^0 is 77.

    • 115÷8=14115 \div 8 = 14 with a remainder of 33 (115−8×14=3115 - 8 \times 14 = 3). Digit for 818^1 is 33.

    • 14÷8=114 \div 8 = 1 with a remainder of 66 (14−8×1=614 - 8 \times 1 = 6). Digit for 828^2 is 66.

    • 1÷8=01 \div 8 = 0 with a remainder of 11 (1−8×0=11 - 8 \times 0 = 1). Digit for 838^3 is 11.

    • The whole number part converts to 1637_8$.\n- Algorithm for converting fractional parts from Base 10toOctal(Baseto Octal (Base8):\n - Perform repeated multiplication on the fractional portion by the target base (8).\n - The whole number portion of the multiplication product yields the octal fractional digit.\n - Discard the whole number portion and repeat multiplication on the remaining fractional portion.\n - Fractional multiplication algorithm applied to 0.625_{10}:\n - 0.625 \times 8 = 5.000.\n - The whole number result is 5,leavingafractionalremainderof, leaving a fractional remainder of0.000$.

    • The fractional part converts to .5_8$.\n - Combined result: 927.625_{10} = 1637.5_8$.

  • Algorithm for converting Octal (1637.581637.5_8) back to Decimal (Base 1010):

    • Expand the number using positional powers of 88:

    • 1×83+6×82+3×81+7×80+5×8−11 \times 8^3 + 6 \times 8^2 + 3 \times 8^1 + 7 \times 8^0 + 5 \times 8^{-1}

    • Mathematical evaluation of terms:

    • 83=(23)3=29=5128^3 = (2^3)^3 = 2^9 = 512 (Context: 210=10242^{10} = 1024; 28=2562^8 = 256, which represents 11 byte of color storage or 256256 colors in Windows 95 graphics).

    • 1×512=5121 \times 512 = 512

    • 6×82=6×64=3846 \times 8^2 = 6 \times 64 = 384

    • 3×81=3×8=243 \times 8^1 = 3 \times 8 = 24

    • 7×80=7×1=77 \times 8^0 = 7 \times 1 = 7

    • 5×8−1=5×18=58=0.6255 \times 8^{-1} = 5 \times \frac{1}{8} = \frac{5}{8} = 0.625

    • Summation of expanded components:

    • 512+384=896512 + 384 = 896

    • 24+7=3124 + 7 = 31

    • 896+31=927896 + 31 = 927

    • 927+0.625=927.62510927 + 0.625 = 927.625_{10}

Hexadecimal Conversions and Arithmetic

  • Algorithm for converting whole numbers from Base 1010 to Hexadecimal (Base 1616):

    • Perform repeated division on the integer portion by 16$.\n - Integer division algorithm applied to 927_{10}:\n - 927 \div 16 = 57witharemainderofwith a remainder of15.Hexadecimaldigitfor. Hexadecimal digit for15isisF.\n - 57 \div 16 = 3witharemainderofwith a remainder of9.Hexadecimaldigitis. Hexadecimal digit is9$.

    • 3÷16=03 \div 16 = 0 with a remainder of 33. Hexadecimal digit is 3$.\n - The whole number part converts to 39F_{16}$.

  • Algorithm for converting fractional parts from Base 1010 to Hexadecimal (Base 1616):

    • Perform repeated multiplication on the fractional portion by 16$.\n - Fractional multiplication algorithm applied to 0.625_{10}:\n - 0.625 \times 16 = 10.000$.

    • The whole number result is 1010, which corresponds to hexadecimal digit A$, leaving a remainder of 0.000$.

    • The fractional part converts to .A_{16}$.\n - Combined result: 927.625_{10} = 39F.A_{16}$.

  • Algorithm for converting Hexadecimal (39F.A1639F.A_{16}) back to Decimal (Base 1010):

    • Expand the number using positional powers of 1616:

    • 3×162+9×161+15×160+10×16−13 \times 16^2 + 9 \times 16^1 + 15 \times 16^0 + 10 \times 16^{-1}

    • Mathematical evaluation of terms:

    • 3×162=3×256=7683 \times 16^2 = 3 \times 256 = 768 (Context: 768×1024768 \times 1024 represents the screen display resolution for monitors with a 3:43:4 aspect ratio).

    • 9×161=9×16=1449 \times 16^1 = 9 \times 16 = 144

    • 15×160=15×1=1515 \times 16^0 = 15 \times 1 = 15

    • 10×16−1=1016=58=0.62510 \times 16^{-1} = \frac{10}{16} = \frac{5}{8} = 0.625

    • Summation of expanded components:

    • 768+144=912768 + 144 = 912

    • 912+15=927912 + 15 = 927

    • 927+0.625=927.62510927 + 0.625 = 927.625_{10}

Direct Conversions Between Binary, Octal, and Hexadecimal

  • Mathematical relationship between power-of-two bases:

    • Octal (8=238 = 2^3): Every octal digit corresponds to exactly 33 binary digits (triples/triplets).

    • Hexadecimal (16=2416 = 2^4): Every hexadecimal digit corresponds to exactly 44 binary digits (quartets).

  • Binary to Octal equivalence table (33-bit mapping):

    • 0002=08000_2 = 0_8

    • 0012=18001_2 = 1_8

    • 0102=28010_2 = 2_8

    • 0112=38011_2 = 3_8

    • 1002=48100_2 = 4_8

    • 1012=58101_2 = 5_8

    • 1102=68110_2 = 6_8

    • 1112=78111_2 = 7_8

  • Binary to Hexadecimal equivalence table (44-bit mapping):

    • 00002=0160000_2 = 0_{16}, 00012=1160001_2 = 1_{16}, 00102=2160010_2 = 2_{16}, 00112=3160011_2 = 3_{16}

    • 01002=4160100_2 = 4_{16}, 01012=5160101_2 = 5_{16}, 01102=6160110_2 = 6_{16}, 01112=7160111_2 = 7_{16}

    • 10002=8161000_2 = 8_{16}, 10012=9161001_2 = 9_{16}, 10102=A161010_2 = A_{16}, 10112=B161011_2 = B_{16}

    • 11002=C161100_2 = C_{16}, 11012=D161101_2 = D_{16}, 11102=E161110_2 = E_{16}, 11112=F161111_2 = F_{16}

  • Sequence bit patterns across columns:

    • Ones place (202^0): Alternates every 11 bit (0,1,0,1,…0, 1, 0, 1, \dots).

    • Twos place (212^1): Alternates every 22 bits (0,0,1,1,…0, 0, 1, 1, \dots).

    • Fours place (222^2): Alternates every 44 bits (0,0,0,0,1,1,1,1,…0, 0, 0, 0, 1, 1, 1, 1, \dots).

    • Eights place (232^3): Alternates every 88 bits (88 zeros followed by 88 ones).

  • Rules for grouping binary numbers during direct conversion:

    • Grouping MUST start at the binary point and work outward in both directions.

    • Integer bit grouping moves from right to left starting at the binary point.

    • Fractional bit grouping moves from left to right starting at the binary point.

    • If an integer group lacks sufficient bits, pad with leading implied zeros on the far left.

    • If a fractional group lacks sufficient bits, pad with trailing implied zeros on the far right.

  • Example of Binary to Octal grouping:

    • Binary value: 001 110 011 111.1012001\,110\,011\,111.101_2

    • Partitioned triples: 0012=1001_2 = 1, 1102=6110_2 = 6, 0112=3011_2 = 3, 1112=7111_2 = 7, .1012=.5.101_2 = .5

    • Result: 1637.581637.5_8

  • Example of Binary to Hexadecimal grouping:

    • Binary value: 0011 1001 1111.101020011\,1001\,1111.1010_2

    • Partitioned quartets: 00112=30011_2 = 3, 10012=91001_2 = 9, 11112=F1111_2 = F, .10102=.A.1010_2 = .A

    • Result: 39F.A1639F.A_{16}

    • Importance of trailing zeros: The fractional group .1012.101_2 padded to 4 bits becomes .10102.1010_2 (10/16=A1610/16 = A_{16}). Misinterpreting it as .01012.0101_2 would incorrectly yield 5165_{16}.

  • Philosophical principle of conversion algorithms:

    • Converting between non-decimal bases and Base 1010 uses algorithms calculated in Base 1010 purely because humans are trained in Base 1010 arithmetic. Base 1010 possesses no inherent mathematical superiority over other bases.

Data Storage Mechanics and Binary Addition

  • Digital memory constraints vs. paper representation:

    • In physical memory cells, numbers must fill fixed bit width boundaries. Leading or trailing zeros cannot simply be omitted.

    • Integer representation in hardware uses explicit leading zeros to fill fixed register widths.

    • Floating-point numbers use normalized scientific notation where the leading bit is always an implied 11. Computer hardware omits storing this leading 11 bit to maximize memory efficiency, and unallocated fractional bits are filled with trailing zeros.

  • Single-digit binary addition rules (22 bits):

    • 0+0=00 + 0 = 0

    • 0+1=10 + 1 = 1

    • 1+0=11 + 0 = 1

    • 1+1=1021 + 1 = 10_2 (sum 00, carry 11 into the twos place)

  • Three-digit binary addition rules (22 operand bits + 11 carry-in bit):

    • 0+0+0=0020 + 0 + 0 = 00_2 (00

    • 0+0+1=0120 + 0 + 1 = 01_2 (11

    • 0+1+0=0120 + 1 + 0 = 01_2 (11

    • 0+1+1=1020 + 1 + 1 = 10_2 (22

    • 1+0+0=0121 + 0 + 0 = 01_2 (11

    • 1+0+1=1021 + 0 + 1 = 10_2 (22

    • 1+1+0=1021 + 1 + 0 = 10_2 (22

    • 1+1+1=1121 + 1 + 1 = 11_2 (33

  • Adder logic circuit classifications:

    • Half Adder: A logic circuit that implements binary addition on two 11-bit inputs but cannot process an incoming carry bit.

    • Full Adder: A complete single-place value logic circuit that adds three 11-bit inputs (two operand bits plus one carry-in bit).

  • Multi-bit Unsigned Binary Addition Example:

    • Problem: Add 101121011_2 (111011_{10}) and 110121101_2 (131013_{10})

    • Step-by-step computation:

    • Ones place (202^0): 1+1=01 + 1 = 0, carry 11

    • Twos place (212^1): 1 (carry)+1+0=01 \text{ (carry)} + 1 + 0 = 0, carry 11

    • Fours place (222^2): 1 (carry)+0+1=01 \text{ (carry)} + 0 + 1 = 0, carry 11

    • Eights place (232^3): 1 (carry)+1+1=11 \text{ (carry)} + 1 + 1 = 1, carry 11

    • Sixteens place (242^4): 1 (carry)+0+0=11 \text{ (carry)} + 0 + 0 = 1

    • Result: 11000211000_2

    • Base 1010 verification: 16+8=241016 + 8 = 24_{10}. Check: 11+13=241011 + 13 = 24_{10}.

Binary Subtraction Algorithms and Borrowing

  • Manual/Paper Unsigned Binary Subtraction Rules:

    • 0−0=00 - 0 = 0

    • 1−0=11 - 0 = 1

    • 1−1=01 - 1 = 0

    • 0−1=10 - 1 = 1 (requires borrowing 11 from the next higher place value, which acts as a value of 2102_{10} in the current column, evaluating 2−1=12 - 1 = 1)

  • Hardware vs. Paper Subtraction:

    • Physical computer circuits do not utilize borrowing logic for subtraction.

    • Hardware transforms subtraction into an addition problem by converting numbers into signed representations (such as Two's Complement) and routing them through an adder-subtractor circuit.

  • Manual Unsigned Subtraction Example:

    • Subtract 110121101_2 (131013_{10}) from 10111210111_2 (231023_{10}):

    • Ones place: 1−1=01 - 1 = 0

    • Twos place: 1−0=11 - 0 = 1

    • Fours place: 1−1=01 - 1 = 0

    • Eights place: 0−1→0 - 1 \rightarrow borrow 11 from the sixteens place. The sixteens place becomes 00; the eights place receives 10210_2 (2102_{10}). Then 2−1=12 - 1 = 1

    • Sixteens place: 0−0=00 - 0 = 0

    • Result: 010102=101001010_2 = 10_{10}

    • Base 1010 verification: 23−13=101023 - 13 = 10_{10}.

  • Chain Borrowing Mechanics:

    • Decimal review analog: Subtracting 62310623_{10} from 9001109001_{10} requires cascading borrows from the thousands place across the hundreds and tens places down to the ones place, resulting in 8378108378_{10}.

    • Binary chain borrowing example: Subtract 1012101_2 (5105_{10}) from 100021000_2 (8108_{10}):

    • Ones place (0−10 - 1) cannot execute, triggering a cascade borrow to the eights place.

    • Eights place bit (11) drops to 00, transferring 10210_2 (2102_{10}) to the fours place.

    • Fours place bit drops to 11, transferring 10210_2 (2102_{10}) to the twos place.

    • Twos place bit drops to 11, transferring 10210_2 (2102_{10}) to the ones place.

    • Ones place computation: 2−1=12 - 1 = 1

    • Twos place computation: 1−0=11 - 0 = 1

    • Fours place computation: 1−1=01 - 1 = 0

    • Eights place computation: 0−0=00 - 0 = 0

    • Result: 00112=3100011_2 = 3_{10}

    • Base 1010 verification: 8−5=3108 - 5 = 3_{10}.

Binary Multiplication Techniques

  • Binary Multiplication Facts:

    • 0×0=00 \times 0 = 0

    • 0×1=00 \times 1 = 0

    • 1×0=01 \times 0 = 0

    • 1×1=11 \times 1 = 1

  • Multiplication execution process:

    • Calculate partial products for each digit of the multiplier, applying left shifts for each successive higher position.

    • Sum the partial products using binary addition.

    • Accumulating multiple partial product rows may yield sums requiring carries greater than 11 into higher power columns.

  • Example 1: Multiply 1012101_2 (5105_{10}) by 11211_2 (3103_{10}):

    • Partial product 1 (ones bit): 1×1012=10121 \times 101_2 = 101_2

    • Partial product 2 (twos bit): 1×1012 shifted left=101021 \times 101_2 \text{ shifted left} = 1010_2

    • Addition: 1012+10102=11112101_2 + 1010_2 = 1111_2

    • Result evaluation: 8+4+2+1=15108 + 4 + 2 + 1 = 15_{10}. Verification: 5×3=15105 \times 3 = 15_{10}.

  • Example 2: Multiply 101121011_2 (111011_{10}) by 1012101_2 (5105_{10}):

    • Partial product 1: 1×10112=101121 \times 1011_2 = 1011_2

    • Partial product 2: 0×10112 shifted left=0000020 \times 1011_2 \text{ shifted left} = 00000_2

    • Partial product 3: 1×10112 shifted twice left=10110021 \times 1011_2 \text{ shifted twice left} = 101100_2

    • Summation of non-zero rows:

    • 10112+1011002=11011121011_2 + 101100_2 = 110111_2

    • Result evaluation: 32+16+0+4+2+1=551032 + 16 + 0 + 4 + 2 + 1 = 55_{10}. Verification: 11×5=551011 \times 5 = 55_{10}.

    • Shortcut identification for 551055_{10}: A 66-bit string of all ones (1111112111111_2) equals 631063_{10}. Subtracting 8108_{10} (100021000_2) clears the eights place bit, leaving 1101112=5510110111_2 = 55_{10}.