self // other
(self, other, context=None)
| 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__.""" |
no test coverage detected