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)
| 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""" |