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

Method minus

Lib/_pydecimal.py:4904–4919  ·  view source on GitHub ↗

Minus corresponds to unary prefix minus in Python. The operation is evaluated using the same rules as subtract; the operation minus(a) is calculated as subtract('0', a) where the '0' has the same exponent as the operand. >>> ExtendedContext.minus(Decimal('1.3'))

(self, a)

Source from the content-addressed store, hash-verified

4902 return a.min_mag(b, context=self)
4903
4904 def minus(self, a):
4905 """Minus corresponds to unary prefix minus in Python.
4906
4907 The operation is evaluated using the same rules as subtract; the
4908 operation minus(a) is calculated as subtract('0', a) where the '0'
4909 has the same exponent as the operand.
4910
4911 >>> ExtendedContext.minus(Decimal('1.3'))
4912 Decimal('-1.3')
4913 >>> ExtendedContext.minus(Decimal('-1.3'))
4914 Decimal('1.3')
4915 >>> ExtendedContext.minus(1)
4916 Decimal('-1')
4917 """
4918 a = _convert_other(a, raiseit=True)
4919 return a.__neg__(context=self)
4920
4921 def multiply(self, a, b):
4922 """multiply multiplies two operands.

Callers 1

test_minusMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
__neg__Method · 0.45

Tested by 1

test_minusMethod · 0.76