{{ safesubst:#invoke:Unsubst||$N=Unreferenced |date=__DATE__ |$B= {{#invoke:Message box|ambox}} }}

In digital circuits, an adder–subtractor is a circuit that is capable of adding or subtracting numbers (in particular, binary). Below is a circuit that does adding or subtracting depending on a control signal. It is also possible to construct a circuit that performs both addition and subtraction at the same time.

## Role in the arithmetic logic unit

{{#invoke:main|main}}

Adders are a part of the core of an arithmetic logic unit (ALU). The control unit decides which operations an ALU should perform (based on the op code being executed) and sets the ALU operation. The ${\displaystyle D}$ input to the adder–subtractor above would be one such control line from the control unit.

The adder–subtractor above could easily be extended to include more functions. For example, a 2-to-1 multiplexer could be introduced on each ${\displaystyle B_{i}}$ that would switch between zero and ${\displaystyle B_{i}}$; this could be used (in conjunction with ${\displaystyle D=1}$) to yield the two's complement of ${\displaystyle A}$ since ${\displaystyle -A={\overline {A}}+1}$.

A further step would be to change the 2-to-1 mux on ${\displaystyle A}$ to a 4-to-1 with the third input being zero, then replicating this on ${\displaystyle B_{i}}$ thus yielding the following output functions:

By adding more logic in front of the adder, a single adder can be converted into much more than just an adder—an ALU.