MCPcopy Index your code
hub / github.com/python/cpython / min

Method min

Lib/_pydecimal.py:2823–2855  ·  view source on GitHub ↗

Returns the smaller value. Like min(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds.

(self, other, context=None)

Source from the content-addressed store, hash-verified

2821 return ans._fix(context)
2822
2823 def min(self, other, context=None):
2824 """Returns the smaller value.
2825
2826 Like min(self, other) except if one is not a number, returns
2827 NaN (and signals if one is sNaN). Also rounds.
2828 """
2829 other = _convert_other(other, raiseit=True)
2830
2831 if context is None:
2832 context = getcontext()
2833
2834 if self._is_special or other._is_special:
2835 # If one operand is a quiet NaN and the other is number, then the
2836 # number is always returned
2837 sn = self._isnan()
2838 on = other._isnan()
2839 if sn or on:
2840 if on == 1 and sn == 0:
2841 return self._fix(context)
2842 if sn == 1 and on == 0:
2843 return other._fix(context)
2844 return self._check_nans(other, context)
2845
2846 c = self._cmp(other)
2847 if c == 0:
2848 c = self.compare_total(other)
2849
2850 if c == -1:
2851 ans = self
2852 else:
2853 ans = other
2854
2855 return ans._fix(context)
2856
2857 def _isinteger(self):
2858 """Returns whether self is an integer"""

Callers 15

test_none_argsMethod · 0.95
minMethod · 0.45
buildScrollMarkerFunction · 0.45
yFunction · 0.45
rFunction · 0.45
rtFunction · 0.45
d3.min.jsFile · 0.45
OeFunction · 0.45
BeFunction · 0.45
jeFunction · 0.45
VeFunction · 0.45
UrFunction · 0.45

Calls 7

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

Tested by 3

test_none_argsMethod · 0.76
test_named_parametersMethod · 0.36