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