Version of _check_nans used for the signaling comparisons compare_signal, __le__, __lt__, __ge__, __gt__. Signal InvalidOperation if either self or other is a (quiet or signaling) NaN. Signaling NaNs take precedence over quiet NaNs. Return 0 if neither oper
(self, other, context)
| 729 | return 0 |
| 730 | |
| 731 | def _compare_check_nans(self, other, context): |
| 732 | """Version of _check_nans used for the signaling comparisons |
| 733 | compare_signal, __le__, __lt__, __ge__, __gt__. |
| 734 | |
| 735 | Signal InvalidOperation if either self or other is a (quiet |
| 736 | or signaling) NaN. Signaling NaNs take precedence over quiet |
| 737 | NaNs. |
| 738 | |
| 739 | Return 0 if neither operand is a NaN. |
| 740 | |
| 741 | """ |
| 742 | if context is None: |
| 743 | context = getcontext() |
| 744 | |
| 745 | if self._is_special or other._is_special: |
| 746 | if self.is_snan(): |
| 747 | return context._raise_error(InvalidOperation, |
| 748 | 'comparison involving sNaN', |
| 749 | self) |
| 750 | elif other.is_snan(): |
| 751 | return context._raise_error(InvalidOperation, |
| 752 | 'comparison involving sNaN', |
| 753 | other) |
| 754 | elif self.is_qnan(): |
| 755 | return context._raise_error(InvalidOperation, |
| 756 | 'comparison involving NaN', |
| 757 | self) |
| 758 | elif other.is_qnan(): |
| 759 | return context._raise_error(InvalidOperation, |
| 760 | 'comparison involving NaN', |
| 761 | other) |
| 762 | return 0 |
| 763 | |
| 764 | def __bool__(self): |
| 765 | """Return True if self is nonzero; otherwise return False. |
no test coverage detected