We will study the decimal, binary, hexadecimal, BCD and octal number systems and learn to convert between number systems.
Enter a decimal number between 0 and 4095 to convert to its binary, hexadecimal and BCD equivalent.
Each column in a binary number table represents a power of 2. Multiple row 1 with row 2 to get row 3. Sum row 3 to obtain the decimal value.
Each column in a hexadecimal number table represents a power of 16. Multiple row 1 with row 2 to get row 3. Sum row 3 to obtain the decimal value.
To convert from decimal to BCD, write down the four bit binary pattern for each decimal digit.
To convert from BCD to decimal, divide the number into groups of 4 bits and write down the corresponding decimal digit for each 4 bit group.
Each column in a octal number table represents a power of 8. Multiple row 1 with row 2 to get row 3. Sum row 3 to obtain the decimal value.
The above binary conversion applies only to positive values. When a fixed number of bits is used to hold only positive values, it is said to be unsigned. The range of positive values that can be represented is 0 to 2n-1, where n is the number of bits used.
It is also possible to represent signed (negative as well as positive) numbers in binary. In this case, part of the total range of values is used to represent positive values, and the rest of the range is used to represent negative values.
The most common binary signed numbers representation is called two’s complement. In two’s complement representation, the highest order bit of the number indicates the sign. If the sign bit (MSB) is 0, the number is positive, and if the sign bit is 1, the number is negative. For positive numbers, the remainder bits hold the unsigned binary of the number. For negative numbers, the lower order bits hold the two's complement of the unsigned binary of the number.
Note that the two’s complement representation can only be used when there are a set number of bits. For n bits, the range of values is -2n-1 to 2n-1-1. Enter a decimal number between -128 (-27) and 127 (27-1) to show its signed 8 bits binary equivalent.
Enter two decimal numbers between -128 and 127 to add their 8 bits signed binary equivalents. Entering a negative number is the same as subtracting. The binary number is represented by its 2's complement form.
In elementary arithmetic using decimal numbers, a carry is a digit that is transferred from one column of digits to another column of more significant digits during addition.
Binary addition is done exactly the same way, except that you have only two digits (0 and 1). Thus
If 2 Two's Complement numbers are added, and they both have the same sign (both positive or both negative), then overflow occurs if and only if the result has the opposite sign. Overflow never occurs when adding operands with different signs.
For more information on the implementation of binary arithmetic in logic circuits, see arithmetic combinational circuits.
With advertising revenues falling despite increasing numbers of visitors, we need your help to maintain and improve this site, which takes time, money and hard work. Thanks to the generosity of our visitors who gave earlier, you are able to use this site at no charge.
If you have benefited from this site and are able, please give $10 via Paypal. It will allow us continue into the future. It only takes a minute. Thanks!