The Decimal to Other Bases Converter allows you to convert numbers represented in the decimal numeral system (base-10) into equivalent representations in different numeral systems or bases. You provide a decimal number as input, including integer and fractional parts, and select the target base or numeral system to which you want to convert the decimal. You can choose from a range of typical bases, including binary (base-2), octal (base-8), hexadecimal (base-16), and various other bases up to 36.
Two's Complement
Two's complement is typically discussed in the context of binary (base 2) numbers because it is a standard method for representing signed integers in digital systems. However, the two complements can be extended to other bases, though they are less common in practice. Here's how it works:
Two's Complement in Other Bases
General Steps:
- Positive Numbers: Any base's representation of positive numbers remains the same.
- Negative Numbers:
- Start with the absolute value of the number in the desired base.
- Invert all the digits (find each digit's "base complement").
- Add 1 to the least significant digit (the rightmost digit).
Example in Base 10 (Decimal):
Convert -47 to two's complement in a base 10 system using 3 digits (which is uncommon but useful for illustration):
- Absolute value: The representation of 47 in base 10 is 047 (we use leading zeros to fit into 3 digits).
- Invert the digits: Subtract each digit from 9 (since 10 - 1 = 9).
- 9 - 0 = 9
- 9 - 4 = 5
- 9 - 7 = 2
- So, 047 becomes 952.
- Add 1: Add 1 to the least significant digit:
So, the two's complement representation of -47 in a 3-digit base 10 system is 953.
Example in Base 16 (Hexadecimal):
Convert -26 to two's complement in a 2-digit base 16 system:
- Absolute value: The representation of 26 in hexadecimal is 1A.
- Invert the digits: Subtract each digit from F (since 16 - 1 = F in hexadecimal).
- F - 1 = E
- F - A = 5
- So, 1A becomes E5.
- Add 1: Add 1 to the least significant digit:
So, the two's complement representation of -26 in a 2-digit base 16 system is E6.
Key Points:
- Base Complement: For any base B, the complement of a digit d is B-1-d.
- Carry in Addition: When adding 1, if there's a carry-out from the most significant digit, it wraps around (like in modular arithmetic).
- Common Use: While possible, two's complement is primarily used in binary systems due to its direct alignment with digital hardware and ease of arithmetic operations.