MCPcopy Index your code
hub / github.com/RustPython/RustPython / same_quantum

Method same_quantum

Lib/_pydecimal.py:2559–2572  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 2

same_quantumMethod · 0.45

Calls 3

is_nanMethod · 0.95
is_infiniteMethod · 0.95
_convert_otherFunction · 0.85

Tested by 1