Applies an 'xor' operation between self and other's digits. Both self and other must be logical numbers.
(self, other, context=None)
| 3393 | return _dec_from_triple(0, result.lstrip('0') or '0', 0) |
| 3394 | |
| 3395 | def logical_xor(self, other, context=None): |
| 3396 | """Applies an 'xor' operation between self and other's digits. |
| 3397 | |
| 3398 | Both self and other must be logical numbers. |
| 3399 | """ |
| 3400 | if context is None: |
| 3401 | context = getcontext() |
| 3402 | |
| 3403 | other = _convert_other(other, raiseit=True) |
| 3404 | |
| 3405 | if not self._islogical() or not other._islogical(): |
| 3406 | return context._raise_error(InvalidOperation) |
| 3407 | |
| 3408 | # fill to context.prec |
| 3409 | (opa, opb) = self._fill_logical(context, self._int, other._int) |
| 3410 | |
| 3411 | # make the operation, and clean starting zeroes |
| 3412 | result = "".join([str(int(a)^int(b)) for a,b in zip(opa,opb)]) |
| 3413 | return _dec_from_triple(0, result.lstrip('0') or '0', 0) |
| 3414 | |
| 3415 | def max_mag(self, other, context=None): |
| 3416 | """Compares the values numerically with their sign ignored.""" |