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, retur
(self, other, context=None)
| 2560 | return ans |
| 2561 | |
| 2562 | def same_quantum(self, other, context=None): |
| 2563 | """Return True if self and other have the same exponent; otherwise |
| 2564 | return False. |
| 2565 | |
| 2566 | If either operand is a special value, the following rules are used: |
| 2567 | * return True if both operands are infinities |
| 2568 | * return True if both operands are NaNs |
| 2569 | * otherwise, return False. |
| 2570 | """ |
| 2571 | other = _convert_other(other, raiseit=True) |
| 2572 | if self._is_special or other._is_special: |
| 2573 | return (self.is_nan() and other.is_nan() or |
| 2574 | self.is_infinite() and other.is_infinite()) |
| 2575 | return self._exp == other._exp |
| 2576 | |
| 2577 | def _rescale(self, exp, rounding): |
| 2578 | """Rescale self so that the exponent is exp, either by padding with zeros |