Redstone Comparator

The Redstone comparator (pronounced kəmˈparətər), originally announced as the Capacitor, is a block for use with redstone circuitry, planned to be added in the Redstone Update. It has two inputs: one from the back ('signal A') and one from the side ('signal B'). If signal B is stronger than signal A, there will be no output. Otherwise, it can be set to either repeat signal A at its current strength, or output the difference between both inputs in subtraction code.

It provides a "subtraction" feature which results in the output being the strength of the back ('signal A') being subtracted by the side ('signal B'), however for this to work the player must make sure that the front redstone torch is lit. Signal B has to be less powerful than signal A for it to work. An example is if the back has a strength of 15, and the side has a strength of 1 the output is 14. Right-clicking the comparator will toggle the torch. The torch must be on for comparator subtraction to work.

The comparator also provides a feature which is activated when the rear of the comparator (the side with two redstone torches) is placed against a storage block. Doing this causes the comparator to emit a signal that is equal to the percentage the storage block is full. Some people call this fill-checking.

The comparator looks similar to a repeater, except with an additional redstone torch.

As a block updater (and a fix for the piston pulse bug)
A comparator will continuously update the block in front of it with a 0.5 redstone tick delay. This is very helpful in a lot of situations: Most importantly, when using pistons. Obviously, you can avoid a piston circuit that turns into a BUD by accident. Also, by attaching the input/power source to the air block two blocks above the piston instead of attaching it directly to the piston and placing a comparator at the side of the piston will fix the extremely annoying piston pulse bug. Without comparators it was impossible to fix it due to the randomness of the bug. But since it takes the comparator 0.5 redstone ticks to update the block in front of it, this fix can't be used for instant wire that suffers from the piston pulse bug.

As a low-delay wire/diode
Like a repeater, the comparator acts as a diode. On its own, a comparator can be used as a diode (With only 1/2 tick delay), providing output of the same strength as its input, but not allowing current to flow against the direction of its arrow.

As a comparator
The comparator's side inputs may be used to set a threshold for the input signal. The input, signal A, will only be output if it is greater than or equal to signal B. Otherwise, there is no output. Signal A is the signal inputted into the back of the comparator. Signal B is considered the greater of the two side inputs; the weaker side input is ignored.

As a diminisher
If a comparator is right-clicked, its third redstone torch becomes active. In this state, the output will be signal A minus signal B: the input signal will be reduced by the comparison signal. If signal B is greater than or equal to signal A, of course, there will be no output.

As an inventory capacity checker
If a comparator is provided a container ((regular/large/trapped) chest, furnace, dispenser, hopper, or brewing stand) as an input, it will provide an output based on the percentage of used space in the container. The comparator may be separated from the input by one solid block if the 3 blocks form a line, however redstone current from below the separator may interfere. See below for more info

Inventory checking output
When a container is empty, the output is off.

When it is not empty, the output signal strength is calculated as follows:

Example: 300 blocks in a dispenser (which has 9 slots) produces output with a signal strength of 8: 1 + (300/(9*64))*14 = 8.292, truncated is 8

Items that cannot be stacked (like Minecarts) are considered a full stack (64 items). That means that a dispenser filled with 9 minecarts will output a full strength (15 blocks) signal.

Specific output signal strength creation
It can be useful in redstone circuits to use containers with comparators to create signals of a specific strength. The number of items required in a container to produce a signal of desired strength is calculated as follows:

Example: To use a furnace (which has 3 slots) to create a strength 9 signal, you need 110 items: max(8, (3*64/14)*(9-1)) = 109.714, rounded up is 110

Trivia

 * The comparator does not, however, re-strengthen a redstone signal. This means it can not be used for super-long instant circuits.
 * If placed every block, they can carry a signal for a long time, and at a higher speed than repeaters, without it losing power. Placing a non-transparent block at every corner allows it to bend without losing power.
 * A redstone comparator outputs a strong signal. This does not mean it resets the signal strength like repeaters, but it means the signal can be picked up through a block without using a repeater (Like a repeater)
 * When a redstone comparator is placed facing a powered dispenser, the comparator will give the dispenser constant redstone updates causing it to rapidly dispence items. It will not blink, but it will cause the dispenser to dispence items at a rate of 300 items per minute (or 5 items per second), which can be useful to make an extremely compact arrow launcher. Note: The dispenser will run out of ammunition (If it is filled with 64 in all 9 slots) in two minutes.

Gallery
Komparator Comparador de Redstone Comparateur Компаратор 红石比较器