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

Method is_finite

Lib/_pydecimal.py:4477–4497  ·  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

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