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 mode.

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 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 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 contents checker
If a comparator is provided a container ((regular/large/trapped) Chest, Furnace, Dispenser, Hopper, Brewing Stand, Dropper, Jukebox, or a Detector Rail with a Minecart with Chest / Hopper on it) 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

Jukebox record identification
Unlike most containers, the signal output by a jukebox represents the record it contains. It outputs 0 for no record, 1 for 13, 2 for cat, 3 for blocks, 4 for chirp, 5 for far, 6 for mall, 7 for mellohi, 8 for stal, 9 for strad, 10 for ward, 11 for 11, and 12 for wait. Values 13-15 are unused.

Bugs

 * The comparator does not provide light when powered, nor does it use its lit-state texture (instead, only the torches are on). Spawning in a block 150 and placing it will show a light-producing comparator which does use the lit-state texture, but this block never occurs without the use of cheats.
 * In rare cases the comparator will not send a redstone signal from the jukebox when any disc is put in.

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 second block between redstone, they can carry a signal for a long time, and at a higher speed than repeaters, without it losing power strength. 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)

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