MCPcopy Index your code
hub / github.com/python/cpython / __floordiv__

Method __floordiv__

Lib/_pydecimal.py:1529–1555  ·  view source on GitHub ↗

self // other

(self, other, context=None)

Source from the content-addressed store, hash-verified

1527 return ans._fix(context)
1528
1529 def __floordiv__(self, other, context=None):
1530 """self // other"""
1531 other = _convert_other(other)
1532 if other is NotImplemented:
1533 return other
1534
1535 if context is None:
1536 context = getcontext()
1537
1538 ans = self._check_nans(other, context)
1539 if ans:
1540 return ans
1541
1542 if self._isinfinity():
1543 if other._isinfinity():
1544 return context._raise_error(InvalidOperation, 'INF // INF')
1545 else:
1546 return _SignedInfinity[self._sign ^ other._sign]
1547
1548 if not other:
1549 if self:
1550 return context._raise_error(DivisionByZero, 'x // 0',
1551 self._sign ^ other._sign)
1552 else:
1553 return context._raise_error(DivisionUndefined, '0 // 0')
1554
1555 return self._divide(other, context)[0]
1556
1557 def __rfloordiv__(self, other, context=None):
1558 """Swaps self/other and returns __floordiv__."""

Callers 2

__rfloordiv__Method · 0.45
divide_intMethod · 0.45

Calls 6

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

Tested by

no test coverage detected