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

Method multiply

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

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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 2

_convert_otherFunction · 0.85
__mul__Method · 0.45

Tested by

no test coverage detected