Add comparison-based calculation for some rational generators.

Modify the floored/ceilinged mul-by-frac generator's comparison code
to work in the general case too (when the multiplicand is not 1/Y).
Add similar comparison code for signed truncated mul-by-frac.
Fix overflowing shift value in N+1-bit multiplication.

Also add a test case that would have revealed this problem.
Make GEN-MULTIPLY-SHIFT-EXPR more efficient.

Scale up the multiplier whenever possible so that the 2N-bit and
N+1-bit multiplications are used more often.
Also check if the multipliers have the correct type before using
them for 2N-bit multiplication (the signed version's multipliers
can overflow sometimes).