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

Method compare

tools/python-3.11.9-amd64/Lib/_pydecimal.py:935–951  ·  view source on GitHub ↗

Compare self to other. Return a decimal value: a or b is a NaN ==> Decimal('NaN') a < b ==> Decimal('-1') a == b ==> Decimal('0') a > b ==> Decimal('1')

(self, other, context=None)

Source from the content-addressed store, hash-verified

933 return self._cmp(other) >= 0
934
935 def compare(self, other, context=None):
936 """Compare self to other. Return a decimal value:
937
938 a or b is a NaN ==> Decimal('NaN')
939 a < b ==> Decimal('-1')
940 a == b ==> Decimal('0')
941 a > b ==> Decimal('1')
942 """
943 other = _convert_other(other, raiseit=True)
944
945 # Compare(NaN, NaN) = NaN
946 if (self._is_special or other and other._is_special):
947 ans = self._check_nans(other, context)
948 if ans:
949 return ans
950
951 return Decimal(self._cmp(other))
952
953 def __hash__(self):
954 """x.__hash__() <==> hash(x)"""

Callers 2

compare_signalMethod · 0.95
compareMethod · 0.45

Calls 4

_check_nansMethod · 0.95
_cmpMethod · 0.95
_convert_otherFunction · 0.85
DecimalClass · 0.85

Tested by

no test coverage detected