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

Method min

tools/python-3.11.9-amd64/Lib/_pydecimal.py:2868–2900  ·  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

2866 return ans._fix(context)
2867
2868 def min(self, other, context=None):
2869 """Returns the smaller value.
2870
2871 Like min(self, other) except if one is not a number, returns
2872 NaN (and signals if one is sNaN). Also rounds.
2873 """
2874 other = _convert_other(other, raiseit=True)
2875
2876 if context is None:
2877 context = getcontext()
2878
2879 if self._is_special or other._is_special:
2880 # If one operand is a quiet NaN and the other is number, then the
2881 # number is always returned
2882 sn = self._isnan()
2883 on = other._isnan()
2884 if sn or on:
2885 if on == 1 and sn == 0:
2886 return self._fix(context)
2887 if sn == 1 and on == 0:
2888 return other._fix(context)
2889 return self._check_nans(other, context)
2890
2891 c = self._cmp(other)
2892 if c == 0:
2893 c = self.compare_total(other)
2894
2895 if c == -1:
2896 ans = self
2897 else:
2898 ans = other
2899
2900 return ans._fix(context)
2901
2902 def _isinteger(self):
2903 """Returns whether self is an integer"""

Callers 1

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

no test coverage detected