MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / same_quantum

Method same_quantum

tools/python-3.11.9-amd64/Lib/_pydecimal.py:2607–2620  ·  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,

(self, other, context=None)

Source from the content-addressed store, hash-verified

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

Callers 1

same_quantumMethod · 0.45

Calls 3

is_nanMethod · 0.95
is_infiniteMethod · 0.95
_convert_otherFunction · 0.85

Tested by

no test coverage detected