multiply multiplies two operands. If either operand is a special value then the general rules apply. Otherwise, the operands are multiplied together ('long multiplication'), resulting in a number which may be as long as the sum of the lengths of the two operands
(self, a, b)
| 4955 | return a.__neg__(context=self) |
| 4956 | |
| 4957 | def multiply(self, a, b): |
| 4958 | """multiply multiplies two operands. |
| 4959 | |
| 4960 | If either operand is a special value then the general rules apply. |
| 4961 | Otherwise, the operands are multiplied together |
| 4962 | ('long multiplication'), resulting in a number which may be as long as |
| 4963 | the sum of the lengths of the two operands. |
| 4964 | |
| 4965 | >>> ExtendedContext.multiply(Decimal('1.20'), Decimal('3')) |
| 4966 | Decimal('3.60') |
| 4967 | >>> ExtendedContext.multiply(Decimal('7'), Decimal('3')) |
| 4968 | Decimal('21') |
| 4969 | >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('0.8')) |
| 4970 | Decimal('0.72') |
| 4971 | >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('-0')) |
| 4972 | Decimal('-0.0') |
| 4973 | >>> ExtendedContext.multiply(Decimal('654321'), Decimal('654321')) |
| 4974 | Decimal('4.28135971E+11') |
| 4975 | >>> ExtendedContext.multiply(7, 7) |
| 4976 | Decimal('49') |
| 4977 | >>> ExtendedContext.multiply(Decimal(7), 7) |
| 4978 | Decimal('49') |
| 4979 | >>> ExtendedContext.multiply(7, Decimal(7)) |
| 4980 | Decimal('49') |
| 4981 | """ |
| 4982 | a = _convert_other(a, raiseit=True) |
| 4983 | r = a.__mul__(b, context=self) |
| 4984 | if r is NotImplemented: |
| 4985 | raise TypeError("Unable to convert %s to Decimal" % b) |
| 4986 | else: |
| 4987 | return r |
| 4988 | |
| 4989 | def next_minus(self, a): |
| 4990 | """Returns the largest representable number smaller than a. |
nothing calls this directly
no test coverage detected