Log in Sign up
Back to Discover
💻

Subtractor

technology Maturity 7-9

Some parts in computers do math.

Half Subtractor Vektor.svg
Half Subtractor Vektor.svg
They can take numbers away. This helps the machine work. It is like a tiny brain. It can even borrow numbers. Do you like math?

34 words

Computers use tiny parts to do math.

Half Subtractor Vektor.svg
Half Subtractor Vektor.svg
These parts can take numbers away. One part is a half subtractor. It works with two bits. It finds the difference between them.
Full-sub-Fixed.svg
Full-sub-Fixed.svg
Sometimes it must borrow a number. This happens if the second bit is bigger. A full subtractor is also used. It can use three bits. It can take a borrowed bit away too. These parts help machines solve math problems.

74 words

Computers use digital circuits to do math. One type of circuit is a subtractor. It is used to take numbers away.

Half Subtractor Vektor.svg
Half Subtractor Vektor.svg

A half subtractor is a simple part. It works with two bits. These are the inputs. One input is the minuend. The other is the subtrahend. The circuit gives two outputs. One is the difference. The other is the borrow out. A borrow out happens if the second bit is bigger.

Half subtractor using NAND.jpg
Half subtractor using NAND.jpg

Sometimes math needs more bits. A full subtractor is used for this. It works with three bits. It uses the two main bits. It also uses a borrow in. This borrow in comes from a previous step. The full subtractor finds the difference and a new borrow out.

Full-sub-Fixed.svg
Full-sub-Fixed.svg

In a full subtractor, a borrow out is set if the second bit is bigger. This is like how we subtract on paper. If we borrow, we add 2 to the current digit. This helps the circuit find the right answer.

169 words

Computers use digital circuits to do math. A subtractor is a special circuit that performs subtraction. It works with binary numbers. These are numbers made of bits.

Half Subtractor Vektor.svg
Half Subtractor Vektor.svg
You can design a subtractor like an adder. An adder is a circuit that adds numbers together. Subtractors are very important for electronic math. They help machines solve problems quickly.

There are two main types of subtractors. The first type is a half subtractor. It works with two bits. One bit is the minuend. The other bit is the subtrahend. This circuit has two outputs. One output is the difference. The other is the borrow out.

Half subtractor using NAND.jpg
Half subtractor using NAND.jpg
A borrow out happens if the subtrahend is larger. The circuit uses logic gates to find the answer. It uses an XOR gate for the difference. It uses an AND gate for the borrow.

A full subtractor is a more advanced circuit. It handles three input bits at once. It uses the minuend and the subtrahend. It also uses a borrow in. This borrow in comes from a previous bit position.

Full-sub-Fixed.svg
Full-sub-Fixed.svg
The full subtractor gives two outputs too. These are the difference and the borrow out. It is used for multi-bit number calculations. This makes it more powerful than a half subtractor.

Working with a full subtractor is like doing math on paper. When you borrow in a decimal system, you add 10. In a binary circuit, you add 2. This happens when a borrow out is generated. The borrow out is set if the subtrahend is larger.

Half Subtractor Vektor.svg
Half Subtractor Vektor.svg
This helps the circuit find the correct difference. The circuit follows specific rules for every bit. It ensures the math stays accurate every time.

Many circuits use a special trick called two's complement notation. This allows a circuit to use an adder for subtraction. It only costs a small amount to do this. You just add a selector to the carry-in. You also invert the second operand. This links subtraction to addition in a smart way.

Full-sub-Fixed.svg
Full-sub-Fixed.svg
It is a clever way to build a machine. It makes electronic math much more efficient.

355 words

In the world of electronics, a subtractor is a digital circuit designed to perform subtraction. It works by processing binary numbers, which are composed of bits. These circuits are essential for arithmetic logic, allowing machines to calculate differences between values. Interestingly, a subtractor can be designed using a very similar approach to a binary adder. While an adder combines values, a subtractor handles the removal of one value from another. This process is a fundamental building block for how computers handle math.

To understand how the mechanism works, we must look at the specific bits involved. In a general calculation for multi-bit numbers, three bits are used for each position. The first is the minuend, which is the number being subtracted from. The second is the subtrahend, which is the number being taken away. The third is the borrow in, which comes from a less significant bit position. These inputs result in two specific outputs: the difference bit and the borrow out bit.

Half Subtractor Vektor.svg
Half Subtractor Vektor.svg

A simple version of this circuit is called a half subtractor. This is a combinational circuit used to subtract exactly two bits. It takes the minuend and the subtrahend as its only inputs. The circuit produces a difference bit and a borrow out signal. The borrow out is specifically set when the subtrahend is greater than the minuend. This signal tells the next digit in a larger calculation that it needs to borrow.

Half subtractor using NAND.jpg
Half subtractor using NAND.jpg

Logic gates drive the operation of the half subtractor. The difference bit is calculated using an exclusive or (XOR) gate. This gate produces a 1 if the inputs are different and a 0 if they are the same. The borrow out is determined by an AND gate. This gate only outputs a 1 if the subtrahend is 1 and the minuend is 0. This specific logic ensures the circuit follows the rules of binary subtraction accurately.

A more complex version is the full subtractor. This circuit is necessary for multi-bit subtraction because it can handle three input bits. In addition to the minuend and the subtrahend, it accepts a borrow in. This borrow in represents a value taken from a previous, less significant digit. The full subtractor then generates its own difference and borrow out bits.

Full-sub-Fixed.svg
Full-sub-Fixed.svg

The full subtractor follows a specific mathematical process. When a borrow in occurs, it is subtracted from the minuend along with the subtrahend. The formula for this operation is D = X ⊕ Y ⊕ Bin. If a borrow out must be generated, it means the combined value of the subtrahend and borrow in is larger than the minuend. In this case, a value of 2 is added to the current digit. This is very similar to decimal subtraction, where you add 10 when you borrow from the next column.

Engineers often use a clever method to make these circuits more efficient. Instead of building separate subtraction hardware, they use two's complement notation. This notation allows a standard binary adder to perform subtraction. To do this, the circuit only needs to invert the second operand. It also requires an addition/subtraction selector connected to the carry-in. This method is used because it comes at only a small cost to the circuit design.

By combining these elements, digital systems can perform complex arithmetic. The relationship between adders and subtractors shows how different mathematical operations can be linked. Whether using a simple half subtractor or a full subtractor, the logic remains consistent. These circuits allow for the precise, high-speed calculations required by all modern electronic technology.

593 words
🖼️ Images & Media (3)
File:Half Subtractor Vektor.svg
Half Subtractor Vektor.svg
File:Half subtractor using NAND.jpg
Half subtractor using NAND.jpg
File:Full-sub-Fixed.svg
Full-sub-Fixed.svg
Up Next
💻
Adder (electronics)
Technology
More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.