Copies the second operand's sign to the first one. In detail, it returns a copy of the first operand with the sign equal to the sign of the second operand. >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33')) Decimal('1.50') >>> ExtendedContext.c
(self, a, b)
| 4313 | return a.copy_negate() |
| 4314 | |
| 4315 | def copy_sign(self, a, b): |
| 4316 | """Copies the second operand's sign to the first one. |
| 4317 | |
| 4318 | In detail, it returns a copy of the first operand with the sign |
| 4319 | equal to the sign of the second operand. |
| 4320 | |
| 4321 | >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33')) |
| 4322 | Decimal('1.50') |
| 4323 | >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33')) |
| 4324 | Decimal('1.50') |
| 4325 | >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33')) |
| 4326 | Decimal('-1.50') |
| 4327 | >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33')) |
| 4328 | Decimal('-1.50') |
| 4329 | >>> ExtendedContext.copy_sign(1, -2) |
| 4330 | Decimal('-1') |
| 4331 | >>> ExtendedContext.copy_sign(Decimal(1), -2) |
| 4332 | Decimal('-1') |
| 4333 | >>> ExtendedContext.copy_sign(1, Decimal(-2)) |
| 4334 | Decimal('-1') |
| 4335 | """ |
| 4336 | a = _convert_other(a, raiseit=True) |
| 4337 | return a.copy_sign(b) |
| 4338 | |
| 4339 | def divide(self, a, b): |
| 4340 | """Decimal division in a specified context. |