MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / max_mag

Method max_mag

tools/python-3.11.9-amd64/Lib/_pydecimal.py:3448–3476  ·  view source on GitHub ↗

Compares the values numerically with their sign ignored.

(self, other, context=None)

Source from the content-addressed store, hash-verified

3446 return _dec_from_triple(0, result.lstrip('0') or '0', 0)
3447
3448 def max_mag(self, other, context=None):
3449 """Compares the values numerically with their sign ignored."""
3450 other = _convert_other(other, raiseit=True)
3451
3452 if context is None:
3453 context = getcontext()
3454
3455 if self._is_special or other._is_special:
3456 # If one operand is a quiet NaN and the other is number, then the
3457 # number is always returned
3458 sn = self._isnan()
3459 on = other._isnan()
3460 if sn or on:
3461 if on == 1 and sn == 0:
3462 return self._fix(context)
3463 if sn == 1 and on == 0:
3464 return other._fix(context)
3465 return self._check_nans(other, context)
3466
3467 c = self.copy_abs()._cmp(other.copy_abs())
3468 if c == 0:
3469 c = self.compare_total(other)
3470
3471 if c == -1:
3472 ans = other
3473 else:
3474 ans = self
3475
3476 return ans._fix(context)
3477
3478 def min_mag(self, other, context=None):
3479 """Compares the values numerically with their sign ignored."""

Callers 1

max_magMethod · 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

no test coverage detected