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

Method __mod__

tools/python-3.11.9-amd64/Lib/_pydecimal.py:1476–1501  ·  view source on GitHub ↗

self % other

(self, other, context=None)

Source from the content-addressed store, hash-verified

1474 return other.__divmod__(self, context=context)
1475
1476 def __mod__(self, other, context=None):
1477 """
1478 self % other
1479 """
1480 other = _convert_other(other)
1481 if other is NotImplemented:
1482 return other
1483
1484 if context is None:
1485 context = getcontext()
1486
1487 ans = self._check_nans(other, context)
1488 if ans:
1489 return ans
1490
1491 if self._isinfinity():
1492 return context._raise_error(InvalidOperation, 'INF % x')
1493 elif not other:
1494 if self:
1495 return context._raise_error(InvalidOperation, 'x % 0')
1496 else:
1497 return context._raise_error(DivisionUndefined, '0 % 0')
1498
1499 remainder = self._divide(other, context)[1]
1500 remainder = remainder._fix(context)
1501 return remainder
1502
1503 def __rmod__(self, other, context=None):
1504 """Swaps self/other and returns __mod__."""

Callers 2

__rmod__Method · 0.45
remainderMethod · 0.45

Calls 7

_check_nansMethod · 0.95
_isinfinityMethod · 0.95
_divideMethod · 0.95
_convert_otherFunction · 0.85
getcontextFunction · 0.85
_raise_errorMethod · 0.80
_fixMethod · 0.80

Tested by

no test coverage detected