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

Method min

Lib/_pydecimal.py:2820–2852  ·  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

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

Callers 15

test_none_argsMethod · 0.95
kv_getFunction · 0.45
minMethod · 0.45
test_named_parametersMethod · 0.45
find_unclosed_bracketFunction · 0.45
readMethod · 0.45
writeMethod · 0.45
recv_intoMethod · 0.45
parse_ancillary_dataMethod · 0.45
acquireMethod · 0.45
__setstate__Method · 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