Binaries#
Binary is the base-2 numbering system consisting solely of 0 s and 1 s.
Decimal and Binary Conversion#
Binary to Decimal#
Reverse the order of the binary code and multiply each binary number with its corresponding power of 2, and add the products.
To convert binary 1101 to decimal:
Binary 1101 in decimal: \(8 + 4 + 0 + 1 = 13\)
Octal to Decimal#
Method A#
Starting from the right, multiply the digits with the corresponding powers of 8 and add the results.
To convert octal number 15 to decimal:
Octal number 15 in decimal: 13
Method B#
Write the three-digit binary representation of each octal digit side-by-side.
To convert octal number 15 to binary:
Octal number 15 in binary: 001101
Convert binary to decimal.
Binary 001101 in decimal: 13
Hexadecimal to Decimal#
Method A#
Convert each digit to its corresponding decimal value. Multiply each digits by powers of 16, starting from the rightmost, and sum the products.
To convert hexadecimal 0xD to decimal:
Hexadecimal 0xD in decimal: 13
Method B#
Convert each digit to its corresponding binary value.
Convert hexadecimal 0xD to binary:
Hexadecimal 0xD in binary: 1101
Convert binary to decimal.
Binary 1101 in decimal: 13
Decimal to Binary#
Return the modulo of the decimal until quotient becomes 0, and reverse the order of remainders. To convert decimal 13 to binary:
Decimal 13 in binary: 1101.
Decimal to Octal#
First, convert decimal to binary.
Starting from the right, group the binary digits into 3. Per group, each digit is represented as 4-2-1—add these up and concatenate the sum of every group. To convert binary 1101 to octal:
Binary 1101 in octal: 15
Decimal to Hexadecimal#
First, convert decimal to binary.
Group the binary digits into sets of four, starting from the right, and then convert each group into its corresponding hexadecimal digit:
To convert binary 1101 to hexadecimal:
Binary 1101 in hexadecimal: #D or 0xD
Binary Operations#
Carry Over |
Results |
|
|---|---|---|
0 + 0 |
0 |
0 |
0 + 1 |
0 |
1 |
1 + 0 |
0 |
1 |
1 + 1 |
1 |
0 |
1 + 1 + 1 |
1 |
1 |
Result |
|
|---|---|
1 - 0 |
1 |
1 - 1 |
0 |
0 - 0 |
0 |
0 - 1 |
1 |
Result |
|
|---|---|
0 * 0 |
0 |
0 * 1 |
0 |
1 * 0 |
0 |
1 * 1 |
1 |
Result |
|
|---|---|
0 / 1 |
0 |
1 / 1 |
1 |