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

Method divide_int

Lib/_pydecimal.py:4373–4394  ·  view source on GitHub ↗

Divides two numbers and returns the integer part of the result. >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3')) Decimal('0') >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3')) Decimal('3') >>> ExtendedContext.divide_int(Decimal('1'), Decim

(self, a, b)

Source from the content-addressed store, hash-verified

4371 return r
4372
4373 def divide_int(self, a, b):
4374 """Divides two numbers and returns the integer part of the result.
4375
4376 >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3'))
4377 Decimal('0')
4378 >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3'))
4379 Decimal('3')
4380 >>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3'))
4381 Decimal('3')
4382 >>> ExtendedContext.divide_int(10, 3)
4383 Decimal('3')
4384 >>> ExtendedContext.divide_int(Decimal(10), 3)
4385 Decimal('3')
4386 >>> ExtendedContext.divide_int(10, Decimal(3))
4387 Decimal('3')
4388 """
4389 a = _convert_other(a, raiseit=True)
4390 r = a.__floordiv__(b, context=self)
4391 if r is NotImplemented:
4392 raise TypeError("Unable to convert %s to Decimal" % b)
4393 else:
4394 return r
4395
4396 def divmod(self, a, b):
4397 """Return (a // b, a % b).

Callers 1

test_divide_intMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
__floordiv__Method · 0.45

Tested by 1

test_divide_intMethod · 0.76