Looking at the problem mathematically: The basic analog operation we have is
a - b, and the values must be between 0 and 15. How can we produce
2·a using that?
2·a = a + a no multiplication, but addition = a - (-a) no addition, but uses negative numbers = 8 + a - (8 - a) in range, but has a + operation = 8 - (-a) - (8 - a) almost there... = 15 - (7 - a) - (8 - a) this can be redstone!
Note that we are finally using 15 and 7, not 16 and 8, because there is no signal strength 16. The output for input 8 will be 15, not 16, because
(7 - a) can only go down to 0 rather than -1.
This is a “physical” implementation of the above formula. The two furnaces are used as signal sources, containing 64+32 and 64+24 items each, causing the comparators to their left (set to subtraction mode) to have input signals of 8 and 7 respectively (which is which doesn’t matter). The torch at the bottom provides the constant 15, and the two comparators on the left side subtract the two intermediate results from 15 to produce the final output on the top left.
The middle right comparator is not actually necessary; it just simplifies seeing where the input to the circuit is and what the signal strength at that point is. It does nothing but repeat the signal (it doesn’t interact with the furnaces). Thus, this circuit can be built with only 4 comparators.
Note that since the output comes from two subtractions in sequence, when the input changes, the output will change in two equally-sized steps. This could be good if you want a smooth change (e.g. if the input goes from 2 to 3 the output will go through 4, 5, 6) but bad if you’re looking for only “correct” outputs (e.g. only even-numbered ones).
The circuit can be compacted by one more block as follows, requiring an additional comparator (which merely repeats the signal, because the input to its right is always weaker and it is not in subtraction mode).
(Another possible compacting is to bring the top and bottom rows right next to each other; this would require feeding the input signal to the two input comparators separately, which might happen to be convenient for some 3D build. Note that you can compensate for signal losses by changing the furnace fill, if your original input’s lowest value is above 0.)
These circuits were built and tested in Minecraft 1.6.2 and should work back to version 1.5, but not before 1.5 as comparators did not exist then.
This was an interesting problem to work on and I found what I think is an elegant solution — thanks for asking!
My solution entirely fails on the compactness and cost front, with 15 repeaters, over a stack of loose redstone and 16×10 size (at least, entirely flat.)…
Pick input signal with repeaters at specific distance from the source (thus only repeaters too far for weak signal won’t pick it, and pass it to repeaters located a specific distance from the target.
The advantage is this “lookup table” approach allows for any arbitrary, non-linear input-output mapping by placing the output repeaters a desired distance from the output. Still, something simpler would be much desired.
This solution is made considerably more compact by taking advantage of the redstone comparator’s ability to act as an output source of the same signal strength that it receives as input.