Compares the values numerically with their sign ignored.
(self, other, context=None)
| 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.""" |
| 3417 | other = _convert_other(other, raiseit=True) |
| 3418 | |
| 3419 | if context is None: |
| 3420 | context = getcontext() |
| 3421 | |
| 3422 | if self._is_special or other._is_special: |
| 3423 | # If one operand is a quiet NaN and the other is number, then the |
| 3424 | # number is always returned |
| 3425 | sn = self._isnan() |
| 3426 | on = other._isnan() |
| 3427 | if sn or on: |
| 3428 | if on == 1 and sn == 0: |
| 3429 | return self._fix(context) |
| 3430 | if sn == 1 and on == 0: |
| 3431 | return other._fix(context) |
| 3432 | return self._check_nans(other, context) |
| 3433 | |
| 3434 | c = self.copy_abs()._cmp(other.copy_abs()) |
| 3435 | if c == 0: |
| 3436 | c = self.compare_total(other) |
| 3437 | |
| 3438 | if c == -1: |
| 3439 | ans = other |
| 3440 | else: |
| 3441 | ans = self |
| 3442 | |
| 3443 | return ans._fix(context) |
| 3444 | |
| 3445 | def min_mag(self, other, context=None): |
| 3446 | """Compares the values numerically with their sign ignored.""" |