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

Method _check_nans

Lib/_pydecimal.py:696–726  ·  view source on GitHub ↗

Returns whether the number is not actually one. if self, other are sNaN, signal if self, other are NaN return nan return 0 Done before operations.

(self, other=None, context=None)

Source from the content-addressed store, hash-verified

694 return 0
695
696 def _check_nans(self, other=None, context=None):
697 """Returns whether the number is not actually one.
698
699 if self, other are sNaN, signal
700 if self, other are NaN return nan
701 return 0
702
703 Done before operations.
704 """
705
706 self_is_nan = self._isnan()
707 if other is None:
708 other_is_nan = False
709 else:
710 other_is_nan = other._isnan()
711
712 if self_is_nan or other_is_nan:
713 if context is None:
714 context = getcontext()
715
716 if self_is_nan == 2:
717 return context._raise_error(InvalidOperation, 'sNaN',
718 self)
719 if other_is_nan == 2:
720 return context._raise_error(InvalidOperation, 'sNaN',
721 other)
722 if self_is_nan:
723 return self._fix_nan(context)
724
725 return other._fix_nan(context)
726 return 0
727
728 def _compare_check_nans(self, other, context):
729 """Version of _check_nans used for the signaling comparisons

Callers 15

__eq__Method · 0.95
compareMethod · 0.95
__neg__Method · 0.95
__pos__Method · 0.95
__abs__Method · 0.95
__add__Method · 0.95
__sub__Method · 0.95
__mul__Method · 0.95
__truediv__Method · 0.95
__divmod__Method · 0.95
__mod__Method · 0.95
remainder_nearMethod · 0.95

Calls 4

_isnanMethod · 0.95
_fix_nanMethod · 0.95
getcontextFunction · 0.85
_raise_errorMethod · 0.80

Tested by

no test coverage detected