Return True if self and other have the same exponent; otherwise return False. If either operand is a special value, the following rules are used: * return True if both operands are infinities * return True if both operands are NaNs * otherwise,
(self, other, context=None)
| 2605 | return ans |
| 2606 | |
| 2607 | def same_quantum(self, other, context=None): |
| 2608 | """Return True if self and other have the same exponent; otherwise |
| 2609 | return False. |
| 2610 | |
| 2611 | If either operand is a special value, the following rules are used: |
| 2612 | * return True if both operands are infinities |
| 2613 | * return True if both operands are NaNs |
| 2614 | * otherwise, return False. |
| 2615 | """ |
| 2616 | other = _convert_other(other, raiseit=True) |
| 2617 | if self._is_special or other._is_special: |
| 2618 | return (self.is_nan() and other.is_nan() or |
| 2619 | self.is_infinite() and other.is_infinite()) |
| 2620 | return self._exp == other._exp |
| 2621 | |
| 2622 | def _rescale(self, exp, rounding): |
| 2623 | """Rescale self so that the exponent is exp, either by padding with zeros |
no test coverage detected