MCPcopy Index your code
hub / github.com/python/cpython / _islogical

Method _islogical

Lib/_pydecimal.py:3318–3330  ·  view source on GitHub ↗

Return True if self is a logical operand. For being logical, it must be a finite number with a sign of 0, an exponent of 0, and a coefficient whose digits must all be either 0 or 1.

(self)

Source from the content-addressed store, hash-verified

3316 return ans._fix(context)
3317
3318 def _islogical(self):
3319 """Return True if self is a logical operand.
3320
3321 For being logical, it must be a finite number with a sign of 0,
3322 an exponent of 0, and a coefficient whose digits must all be
3323 either 0 or 1.
3324 """
3325 if self._sign != 0 or self._exp != 0:
3326 return False
3327 for dig in self._int:
3328 if dig not in '01':
3329 return False
3330 return True
3331
3332 def _fill_logical(self, context, opa, opb):
3333 dif = context.prec - len(opa)

Callers 3

logical_andMethod · 0.95
logical_orMethod · 0.95
logical_xorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected