def rescale(frac, mult):
    """
    frac: fraction positives
    mult: negative multiplier
    End cases 0 and 1 work here.
    Doing the math: wlog, p+n=1, so frac=p=1-n  (for p=%pos, n=%neg)
    """
    #return p/(p+(1-p)*n) # to show similarity to wrong version below
    return frac / (frac + (1-frac) * mult)