Exhaustive Guide to Base Conversions and Binary Arithmetic Logic
Number Systems and Base Representation
Number system conversions cover transformations between Base (Decimal), Base (Binary), Base (Octal), and Base (Hexadecimal).
Octal system characteristics:
Base number system.
Valid digits range from to ( to base ).
Place values represent powers of around the octal point.
Place values to the left of the octal point: (ones place), (eights place), (sixty-fours place), (five-hundred-twelfths place).
Place values to the right of the octal point: (eighths place), (sixty-fourths place), (five-hundred-twelfths place).
Hexadecimal system characteristics:
Base number system.
Valid digits range from to ( to base ).
Digits through require single-character symbols to avoid multi-digit ambiguity.
Hexadecimal digit mappings:
Historical proposal for hex notation: A line-segment symbol representing binary bits where distinct line positions signify the 's, 's, 's, and 's places (e.g., combining lines for and forms ; all lines present forms ).
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 -digit hexadecimal memory address represents binary bits, typical of -bit operating systems like Windows XP.
A -digit hexadecimal memory address represents binary bits, standard in -bit operating systems.
Common programming prefixes:
0xdenotes hexadecimal numbers,0bdenotes binary numbers, and0oor0cdenotes octal numbers.
Base 10 to Octal and Octal to Base 10 Conversions
Algorithm for converting whole numbers from Base to Octal (Base ):
Perform repeated long division on the integer portion by the target base ().
Dividing by 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 () to most significant bit.
Integer division algorithm applied to :
with a remainder of (). Digit for is .
with a remainder of (). Digit for is .
with a remainder of (). Digit for is .
with a remainder of (). Digit for is .
The whole number part converts to 1637_8$.\n- Algorithm for converting fractional parts from Base 108):\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 50.000$.
The fractional part converts to .5_8$.\n - Combined result: 927.625_{10} = 1637.5_8$.
Algorithm for converting Octal () back to Decimal (Base ):
Expand the number using positional powers of :
Mathematical evaluation of terms:
(Context: ; , which represents byte of color storage or colors in Windows 95 graphics).
Summation of expanded components:
Hexadecimal Conversions and Arithmetic
Algorithm for converting whole numbers from Base to Hexadecimal (Base ):
Perform repeated division on the integer portion by 16$.\n - Integer division algorithm applied to 927_{10}:\n - 927 \div 16 = 571515F.\n - 57 \div 16 = 399$.
with a remainder of . Hexadecimal digit is 3$.\n - The whole number part converts to 39F_{16}$.
Algorithm for converting fractional parts from Base to Hexadecimal (Base ):
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 , 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 () back to Decimal (Base ):
Expand the number using positional powers of :
Mathematical evaluation of terms:
(Context: represents the screen display resolution for monitors with a aspect ratio).
Summation of expanded components:
Direct Conversions Between Binary, Octal, and Hexadecimal
Mathematical relationship between power-of-two bases:
Octal (): Every octal digit corresponds to exactly binary digits (triples/triplets).
Hexadecimal (): Every hexadecimal digit corresponds to exactly binary digits (quartets).
Binary to Octal equivalence table (-bit mapping):
Binary to Hexadecimal equivalence table (-bit mapping):
, , ,
, , ,
, , ,
, , ,
Sequence bit patterns across columns:
Ones place (): Alternates every bit ().
Twos place (): Alternates every bits ().
Fours place (): Alternates every bits ().
Eights place (): Alternates every bits ( zeros followed by 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:
Partitioned triples: , , , ,
Result:
Example of Binary to Hexadecimal grouping:
Binary value:
Partitioned quartets: , , ,
Result:
Importance of trailing zeros: The fractional group padded to 4 bits becomes (). Misinterpreting it as would incorrectly yield .
Philosophical principle of conversion algorithms:
Converting between non-decimal bases and Base uses algorithms calculated in Base purely because humans are trained in Base arithmetic. Base 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 . Computer hardware omits storing this leading bit to maximize memory efficiency, and unallocated fractional bits are filled with trailing zeros.
Single-digit binary addition rules ( bits):
(sum , carry into the twos place)
Three-digit binary addition rules ( operand bits + carry-in bit):
(
(
(
(
(
(
(
(
Adder logic circuit classifications:
Half Adder: A logic circuit that implements binary addition on two -bit inputs but cannot process an incoming carry bit.
Full Adder: A complete single-place value logic circuit that adds three -bit inputs (two operand bits plus one carry-in bit).
Multi-bit Unsigned Binary Addition Example:
Problem: Add () and ()
Step-by-step computation:
Ones place (): , carry
Twos place (): , carry
Fours place (): , carry
Eights place (): , carry
Sixteens place ():
Result:
Base verification: . Check: .
Binary Subtraction Algorithms and Borrowing
Manual/Paper Unsigned Binary Subtraction Rules:
(requires borrowing from the next higher place value, which acts as a value of in the current column, evaluating )
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 () from ():
Ones place:
Twos place:
Fours place:
Eights place: borrow from the sixteens place. The sixteens place becomes ; the eights place receives (). Then
Sixteens place:
Result:
Base verification: .
Chain Borrowing Mechanics:
Decimal review analog: Subtracting from requires cascading borrows from the thousands place across the hundreds and tens places down to the ones place, resulting in .
Binary chain borrowing example: Subtract () from ():
Ones place () cannot execute, triggering a cascade borrow to the eights place.
Eights place bit () drops to , transferring () to the fours place.
Fours place bit drops to , transferring () to the twos place.
Twos place bit drops to , transferring () to the ones place.
Ones place computation:
Twos place computation:
Fours place computation:
Eights place computation:
Result:
Base verification: .
Binary Multiplication Techniques
Binary Multiplication Facts:
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 into higher power columns.
Example 1: Multiply () by ():
Partial product 1 (ones bit):
Partial product 2 (twos bit):
Addition:
Result evaluation: . Verification: .
Example 2: Multiply () by ():
Partial product 1:
Partial product 2:
Partial product 3:
Summation of non-zero rows:
Result evaluation: . Verification: .
Shortcut identification for : A -bit string of all ones () equals . Subtracting () clears the eights place bit, leaving .