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

Method copy_negate

Lib/_pydecimal.py:4299–4310  ·  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

4297 return Decimal(a)
4298
4299 def copy_negate(self, a):
4300 """Returns a copy of the operand with the sign inverted.
4301
4302 >>> ExtendedContext.copy_negate(Decimal('101.5'))
4303 Decimal('-101.5')
4304 >>> ExtendedContext.copy_negate(Decimal('-101.5'))
4305 Decimal('101.5')
4306 >>> ExtendedContext.copy_negate(1)
4307 Decimal('-1')
4308 """
4309 a = _convert_other(a, raiseit=True)
4310 return a.copy_negate()
4311
4312 def copy_sign(self, a, b):
4313 """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