MCPcopy Index your code
hub / github.com/python/cpython / copy_negate

Method copy_negate

Lib/_pydecimal.py:4302–4313  ·  view source on GitHub ↗

Returns a copy of the operand with the sign inverted. >>> ExtendedContext.copy_negate(Decimal('101.5')) Decimal('-101.5') >>> ExtendedContext.copy_negate(Decimal('-101.5')) Decimal('101.5') >>> ExtendedContext.copy_negate(1) Decimal('-1')

(self, a)

Source from the content-addressed store, hash-verified

4300 return Decimal(a)
4301
4302 def copy_negate(self, a):
4303 """Returns a copy of the operand with the sign inverted.
4304
4305 >>> ExtendedContext.copy_negate(Decimal('101.5'))
4306 Decimal('-101.5')
4307 >>> ExtendedContext.copy_negate(Decimal('-101.5'))
4308 Decimal('101.5')
4309 >>> ExtendedContext.copy_negate(1)
4310 Decimal('-1')
4311 """
4312 a = _convert_other(a, raiseit=True)
4313 return a.copy_negate()
4314
4315 def copy_sign(self, a, b):
4316 """Copies the second operand's sign to the first one.

Callers 2

test_copy_negateMethod · 0.95
test_copyMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
copy_negateMethod · 0.45

Tested by 2

test_copy_negateMethod · 0.76
test_copyMethod · 0.76