MCPcopy Index your code
hub / github.com/RustPython/RustPython / max_mag

Method max_mag

Lib/_pydecimal.py:3412–3440  ·  view source on GitHub ↗

Compares the values numerically with their sign ignored.

(self, other, context=None)

Source from the content-addressed store, hash-verified

3410 return _dec_from_triple(0, result.lstrip('0') or '0', 0)
3411
3412 def max_mag(self, other, context=None):
3413 """Compares the values numerically with their sign ignored."""
3414 other = _convert_other(other, raiseit=True)
3415
3416 if context is None:
3417 context = getcontext()
3418
3419 if self._is_special or other._is_special:
3420 # If one operand is a quiet NaN and the other is number, then the
3421 # number is always returned
3422 sn = self._isnan()
3423 on = other._isnan()
3424 if sn or on:
3425 if on == 1 and sn == 0:
3426 return self._fix(context)
3427 if sn == 1 and on == 0:
3428 return other._fix(context)
3429 return self._check_nans(other, context)
3430
3431 c = self.copy_abs()._cmp(other.copy_abs())
3432 if c == 0:
3433 c = self.compare_total(other)
3434
3435 if c == -1:
3436 ans = other
3437 else:
3438 ans = self
3439
3440 return ans._fix(context)
3441
3442 def min_mag(self, other, context=None):
3443 """Compares the values numerically with their sign ignored."""

Callers 4

test_none_argsMethod · 0.95
max_magMethod · 0.45
test_named_parametersMethod · 0.45

Calls 8

_isnanMethod · 0.95
_fixMethod · 0.95
_check_nansMethod · 0.95
copy_absMethod · 0.95
compare_totalMethod · 0.95
_convert_otherFunction · 0.85
getcontextFunction · 0.85
_cmpMethod · 0.45

Tested by 3

test_none_argsMethod · 0.76
test_named_parametersMethod · 0.36