'Quantize self so its exponent is the same as that of exp.
Similar to self._rescale(exp._exp) but with error checking.'

def quantize(self, exp, rounding=None, context=None, watchexp=1):

    if (self._is_special or exp._is_special):
        ans = self._check_nans(exp, context)
        if ans:
            return ans
        if (exp._isinfinity() or self._isinfinity()):
            if (exp._isinfinity() and self._isinfinity()):
                return self
            if (context is None):
                context = getcontext()
            return context._raise_error(InvalidOperation, 'quantize    with    one    INF')
    return self._rescale(exp._exp, rounding, context, watchexp)
