Método Python cmath.isinf()
Exemplo
Verifique se um valor complexo é infinito ou não:
#import cmath for complex number operations
import cmath
#find
whether a complex number is infinite or not
print (cmath.isinf(complex(10
+ float('inf'))))
print (cmath.isinf(11 + 4j))
Definição e uso
O cmath.isinf()
método verifica se um valor é infinito positivo ou negativo, ou não. Este método retorna um valor booleano: True
se o valor for infinito, caso contrário False
.
Sintaxe
cmath.isinf(x)
Valores de parâmetro
Parameter | Description |
---|---|
x | Required. The value to check for infinity |
Detalhes técnicos
Valor de retorno: | Um bool valor, True se o valor for infinito, caso contrárioFalse |
---|---|
Versão do Python: | 2.6 |