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

Method __floordiv__

Lib/_pydecimal.py:1526–1552  ·  view source on GitHub ↗

self // other

(self, other, context=None)

Source from the content-addressed store, hash-verified

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