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