Python math.inf Konstanta
Contoh
Cetak tak terhingga positif dan negatif:
# Import math Library
import math
# Print the positive infinity
print (math.inf)
# Print the negative infinity
print (-math.inf)
Definisi dan Penggunaan
Konstanta math.inf
mengembalikan infinity positif floating-point.
Untuk tak terhingga negatif, gunakan -math.inf
.
Konstanta inf setara dengan float('inf')
.
Sintaksis
math.inf
Detail Teknis
Nilai Kembali: | Sebuah float nilai, mewakili nilai tak terhingga positif |
---|---|
Versi Python: | 3.5 |