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

Method is_finite

Lib/_pydecimal.py:4480–4500  ·  view source on GitHub ↗

Return True if the operand is finite; otherwise return False. A Decimal instance is considered finite if it is neither infinite nor a NaN. >>> ExtendedContext.is_finite(Decimal('2.50')) True >>> ExtendedContext.is_finite(Decimal('-0.3')) True

(self, a)

Source from the content-addressed store, hash-verified

4478 return a.is_canonical()
4479
4480 def is_finite(self, a):
4481 """Return True if the operand is finite; otherwise return False.
4482
4483 A Decimal instance is considered finite if it is neither
4484 infinite nor a NaN.
4485
4486 >>> ExtendedContext.is_finite(Decimal('2.50'))
4487 True
4488 >>> ExtendedContext.is_finite(Decimal('-0.3'))
4489 True
4490 >>> ExtendedContext.is_finite(Decimal('0'))
4491 True
4492 >>> ExtendedContext.is_finite(Decimal('Inf'))
4493 False
4494 >>> ExtendedContext.is_finite(Decimal('NaN'))
4495 False
4496 >>> ExtendedContext.is_finite(1)
4497 True
4498 """
4499 a = _convert_other(a, raiseit=True)
4500 return a.is_finite()
4501
4502 def is_infinite(self, a):
4503 """Return True if the operand is infinite; otherwise return False.

Callers 1

test_is_finiteMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
is_finiteMethod · 0.45

Tested by 1

test_is_finiteMethod · 0.76