Principle of Water Content Test of Insulating Oil
Collecting Oil Sample from Oil Immersed Electrical Equipment
Causes of Insulating Oil Deterioration
Acidity Test of Transformer Insulating Oil
Magnetic FieldClosely Related Articles
Binary Number System | Binary to Decimal and Decimal to Binary Conversion
Binary to Decimal and Decimal to Binary Conversion
BCD or Binary Coded Decimal | BCD Conversion Addition Subtraction
Binary to Octal and Octal to Binary Conversion
Octal to Decimal and Decimal to Octal Conversion
Binary to Hexadecimal and Hex to Binary Conversion
Hexadecimal to Decimal and Decimal to Hexadecimal Conversion
Gray Code | Binary to Gray Code and that to Binary Conversion
Octal Number System
Digital Logic Gates
2s Complement Arithmetic
Error Detection and Correction Codes
9s complement and 10s complement | Subtraction
Some Common Applications of Logic Gates
Alphanumeric codes | ASCII code | EBCDIC code | UNICODE
Boolean Algebra Theorems and Laws of Boolean Algebra
De Morgan Theorem and Demorgans Laws
Truth Tables for Digital Logic
Simplifying Boolean Expression using K Map
Excess 3 Code Addition and Subtraction
K Map or Karnaugh Map
Switching Algebra or Boolean Algebra
Binary Adder Half and Full Adder
Seven Segment Display
Binary to Gray Code Converter and Grey to Binary Code Converter
Binary to BCD Code Converter
Analog to Digital Converter
Digital Encoder or Binary Encoder
Basic Digital Counter
BCD to Seven Segment Decoder
Parallel Adder or Subtractor
555 Timer and 555 Timer Working
Look Ahead Carry Adder
OR Operation | Logical OR Operation
AND Operation | Logical AND Operation
Logical OR Gate
Logical AND Gate
Universal Gate | NAND and NOR Gate as Universal Gate
Diode and Transistor NAND Gate or DTL NAND Gate and NAND Gate ICs
X OR Gate and X NOR Gate
Transistor Transistor Logic or TTL
Fan out of Logic Gates
NMOS Logic and PMOS Logic
Logic Families Significance and Types of Logic Families
S R Flip Flop
Active Low S R Latch
Clocked S R Flip Flops
D Flip Flop
J K Flip Flop
Master Slave Flip Flop
Read Only Memory
Programmable Logic Devices
Programmable Array Logic
Application of Flip Flops
Buffer Register and Controlled Buffer Register
Data Transfer in Shift Registers
Serial In Serial Out (SISO) Shift Register
Serial in Parallel Out (SIPO) Shift Register
Parallel in Serial Out (PISO) Shift Register
Parallel in Parallel Out (PIPO) Shift Register
Universal Shift Registers
Bidirectional Shift Register
Dynamic Shift Register
Applications of Shift Registers
Conversion of Flip Flops
Complement Number SystemThe word complement in the number system means the difference of the number from the highest number of that digit. This definition can be applied to various number systems and they are named differently as well. But in general, if a number has base of N then that is known as (N-1)’s complement. However, if we add one with that value that will give us N’s complement. For example let us start with decimal number because we are mostly familiar with that number system. Let us take a number 25. The complement can be found out in two ways and since it has a base of 10, which will be called as (10 - 1) that is 9’s complement.
Method 1: The first method is to subtract the number from highest number of that digit which implies number has to be subtracted from 99. So we get (99 - 25) that is 74. Method 2: In the second method each digit is considered individually and subtracted from 9 since 9 is the highest. So we get 9 - 2, 9 - 5 which means the answer is 74. So we have got the same answer and both the methods of finding complement is true and can be applied according to our will. Binary Number System: Now coming to a binary number which is our main topic for discussion. It has only two digits 0 and 1 and hence the name is binary. It has a base of 2 so if we subtract it from the highest number of that digit then we get (2 - 1) that is 1’s complement. If 1 is added with that then we will get 2’s complement. Also, if the individual digit is subtracted from 1 (highest among 0 and 1) then also we will get 1’s complement and adding one with that will give us 2’s complement. However, luckily for us there is another method of finding 1’s complement. We do not have to remember all those steps to find out 1’s and 2’s complement but a simple trick will do the job. Two methods are similar which we have discussed previously but a new method or trick we can use in finding 1’s complement. Let us break the suspense and look at the various methodologies to find out 1’s and 2’s complement with an example. For example, we have to find out 2’s complement of 0100. Here, a zero has been used before the number to make it a four bit number. Since, we have number of bits in the power of two for a binary system. Method - 1 In this method we have to subtract it from 1111 since it is the highest four digit number to find out 1’s complement. 1111 - 0100 is 1011. 2’s complement will be 1011 + 1 that is 1100. Method - 2 Here, subtract every individual digit from 1 to get 1’s complement. Whose result will be 1 - 0, 1 - 1, 1 - 0, 1 - 0, 1 - 0 that is 1011. 2’s complement will be 1011 + 1 = 1100. Method - 3 Here, just we have to replace 1 by 0 and 0 by 1 to find out 1’s complement. Adding one with that result will give us 2’s complement. For 0100, we will have 1’s complement just by replacing 1 by 0 and 0 by 1 and this will give the result 1011. Adding 1 with that result will give us (1011 + 1) that is 1100. So in all of the three methods we see that we have found out the same result and all of the methods are correct and one can use any one of them according to its convenience. 2’s complement representation of positive and negative number.
Why we do need 2’s complement?The main problem of using 2’s complement is that it can be used for subtraction for two binary digits. The computer understands only binary as we know, and there is nothing called as negative number in the binary number system but it is absolutely necessary to represent a negative number using binary which can be done by assigning a sign bit to the number which is an extra bit required. If the sign bit is 1 then number is considered negative and if it is 0, than it will be the number will be called as positive. For subtraction of binary numbers that can be done as follows-
Subtracting a Smaller Number from a Larger Number
- Find 2’s complement of the smaller number.
- Add the larger and 2’s complement of the smaller number.
- Discard the carry.
- After discarding the carry, keep the result which will be answer for subtraction.
Subtracting Larger Number from Smaller Number
- Find 2’s complement of larger number.
- Add 2’s complement of larger number to the smaller number.
- If no carry is generated, find the 2’s complement of the result and the result will be negative.
- If carry is generated, discard the carry and take the result which will be the answer and the sign will be negative.
Advantages of 2’s Complement
- Subtraction can be done with the help of 2’s complement method.
- Easy to accomplish with larger circuit.
- End around carry need not be performed as in the case of 1’s complement.
- Negative number can be represented using 2’s complement.
Closely Related Articles Binary Number System | Binary to Decimal and Decimal to Binary ConversionBinary to Decimal and Decimal to Binary ConversionBCD or Binary Coded Decimal | BCD Conversion Addition SubtractionBinary to Octal and Octal to Binary ConversionOctal to Decimal and Decimal to Octal ConversionBinary to Hexadecimal and Hex to Binary ConversionHexadecimal to Decimal and Decimal to Hexadecimal ConversionGray Code | Binary to Gray Code and that to Binary ConversionOctal Number SystemDigital Logic Gates1′s ComplementASCII CodeHamming Code2s Complement ArithmeticError Detection and Correction Codes9s complement and 10s complement | SubtractionSome Common Applications of Logic GatesKeyboard EncoderAlphanumeric codes | ASCII code | EBCDIC code | UNICODEMore Related Articles Digital ElectronicsBoolean Algebra Theorems and Laws of Boolean AlgebraDe Morgan Theorem and Demorgans LawsTruth Tables for Digital LogicBinary Arithmetic Binary AdditionBinary SubtractionSimplifying Boolean Expression using K MapBinary DivisionExcess 3 Code Addition and SubtractionK Map or Karnaugh MapSwitching Algebra or Boolean AlgebraBinary MultiplicationParallel SubtractorBinary Adder Half and Full AdderBinary SubstractorSeven Segment DisplayBinary to Gray Code Converter and Grey to Binary Code ConverterBinary to BCD Code ConverterAnalog to Digital ConverterDigital Encoder or Binary EncoderBinary DecoderBasic Digital CounterDigital ComparatorBCD to Seven Segment DecoderParallel AdderParallel Adder or SubtractorMultiplexerDemultiplexer555 Timer and 555 Timer WorkingLook Ahead Carry AdderOR Operation | Logical OR OperationAND Operation | Logical AND OperationLogical OR GateLogical AND GateNOT GateUniversal Gate | NAND and NOR Gate as Universal GateNAND GateDiode and Transistor NAND Gate or DTL NAND Gate and NAND Gate ICsX OR Gate and X NOR GateTransistor Transistor Logic or TTLNOR GateFan out of Logic GatesINHIBIT GateNMOS Logic and PMOS LogicSchmitt GatesLogic Families Significance and Types of Logic FamiliesLatches and Flip FlopsS R Flip Flop S R LatchActive Low S R Latch and Flip FlopGated S R Latches or Clocked S R Flip FlopsD Flip Flop or D LatchJ K Flip FlopMaster Slave Flip FlopRead Only Memory | ROMProgrammable Logic DevicesProgrammable Array LogicApplication of Flip FlopsShift RegistersBuffer Register and Controlled Buffer RegisterData Transfer in Shift RegistersSerial In Serial Out (SISO) Shift RegisterSerial in Parallel Out (SIPO) Shift RegisterParallel in Serial Out (PISO) Shift RegisterParallel in Parallel Out (PIPO) Shift RegisterUniversal Shift RegistersBidirectional Shift RegisterDynamic Shift RegisterApplications of Shift RegistersUninterruptible Power Supply | UPSConversion of Flip FlopsJohnson CounterSequence GeneratorRing CounterNew Articles Principle of Water Content Test of Insulating OilCollecting Oil Sample from Oil Immersed Electrical EquipmentCauses of Insulating Oil DeteriorationAcidity Test of Transformer Insulating OilMagnetic Flux