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

Method divmod

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

Return (a // b, a % b). >>> ExtendedContext.divmod(Decimal(8), Decimal(3)) (Decimal('2'), Decimal('2')) >>> ExtendedContext.divmod(Decimal(8), Decimal(4)) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(8, 4) (Decimal('2'), Decimal('0')

(self, a, b)

Source from the content-addressed store, hash-verified

4430 return r
4431
4432 def divmod(self, a, b):
4433 """Return (a // b, a % b).
4434
4435 >>> ExtendedContext.divmod(Decimal(8), Decimal(3))
4436 (Decimal('2'), Decimal('2'))
4437 >>> ExtendedContext.divmod(Decimal(8), Decimal(4))
4438 (Decimal('2'), Decimal('0'))
4439 >>> ExtendedContext.divmod(8, 4)
4440 (Decimal('2'), Decimal('0'))
4441 >>> ExtendedContext.divmod(Decimal(8), 4)
4442 (Decimal('2'), Decimal('0'))
4443 >>> ExtendedContext.divmod(8, Decimal(4))
4444 (Decimal('2'), Decimal('0'))
4445 """
4446 a = _convert_other(a, raiseit=True)
4447 r = a.__divmod__(b, context=self)
4448 if r is NotImplemented:
4449 raise TypeError("Unable to convert %s to Decimal" % b)
4450 else:
4451 return r
4452
4453 def exp(self, a):
4454 """Returns e ** a.

Callers

nothing calls this directly

Calls 2

_convert_otherFunction · 0.85
__divmod__Method · 0.45

Tested by

no test coverage detected