PyDocs

Nav

Numeric and Mathematical Modules

Decimal.copy_sign

decimal

method of Decimal
  • Decimal.copy_sign(other, context=None)
Return a copy of *self* with the sign of *other*.

For example:

    >>> Decimal('2.3').copy_sign(Decimal('-1.5'))
    Decimal('-2.3')

This operation is unaffected by context and is quiet: no flags are
changed and no rounding is performed. As an exception, the C version
may raise InvalidOperation if the second operand cannot be converted
exactly.
1 Example
>>> Decimal('2.3').copy_sign(Decimal('-1.5'))
Decimal('-2.3')
from the Python docs
See Also
No see-alsos for decimal/Decimal.copy_sign
0 Notes
No notes for Decimal.copy_sign