ID EN
Decimal

copy_sign

Python 3.11

Return a copy of the first operand with the sign set to be the same as the sign of the second operand. For example:

Syntax

PYTHON
copy_sign(other, context=None)

Examples

Example 1
PYTHON
>>> Decimal('2.3').copy_sign(Decimal('-1.5'))
Decimal('-2.3')