🌐
W3Schools
w3schools.com › python › ref_math_inf.asp
Python math.inf Constant
# Import math Library import math # Print the positive infinity print (math.inf) # Print the negative infinity print (-math.inf) Try it Yourself » · The math.inf constant returns a floating-point positive infinity.
🌐
W3Schools
w3schools.com › python › ref_cmath_inf.asp
Python cmath.inf Constant
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Training · ❮ cmath Methods · Print the positive and negative infinity: #Import cmath Library import cmath # Print the positive infinity print (cmath.inf) # Print the negative infinity print (-cmath.inf) Try it Yourself » ·
🌐
W3Schools
w3schools.com › PYTHON › ref_math_isinf.asp
Python math.isinf() Method
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... # Import math Library import math # Check whether the values are infinite or not print(math.isinf(56)) print(math.isinf(-45.34)) print(math.isinf(+45.34)) print(math.isinf(math.inf)) print(math.isinf(float("nan"))) print(math.isinf(float("inf"))) print(math.isinf(float("-inf"))) print(math.isinf(-math.inf)) Try it Yourself »
🌐
W3Schools
w3schools.com › python › ref_math_isfinite.asp
Python math.isfinite() Method
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
🌐
W3Schools
w3schools.com › python › trypython.asp
W3Schools online PYTHON editor
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
W3Schools
w3schools.com › python › ref_cmath_infj.asp
Python cmath.infj Constant
The cmath.infj constant returns a complex positive infinity. The return has a 0 real part, and positive infinity as the imaginary part. The cmath.infj constant is equivalent to complex(0.0, float("inf")). ... If you want to use W3Schools services ...
🌐
W3Schools
w3schools.com › python › ref_cmath_isinf.asp
Python cmath.isinf() Method
#import cmath for complex number ... (cmath.isinf(11 + 4j)) Try it Yourself » · The cmath.isinf() method checks whether a value is positive or negative infinity, or not....
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-infinity
Python infinity (inf) - GeeksforGeeks
Infinity represents a value that is greater than every finite number or smaller than every finite negative number. Python does not provide an integer type for infinity, but it supports positive and negative infinity through floating-point values ...
Published: 1 week ago
🌐
FavTutor
favtutor.com › blogs › infinity-python
Infinity in Python (float('inf'), math.inf) | FavTutor
July 21, 2026 - No. Infinity exists only as a float; int("inf") raises a ValueError and int(float("inf")) raises an OverflowError. Python ints are unbounded, so no integer infinity is needed, and float infinity still compares correctly against any int.
Find elsewhere
🌐
W3Schools
devcom.w3schools.com › python › ref_math_isinf.asp
Python math.isinf() Method
Python Examples Python Compiler Python Exercises Python Quiz Python Certificate ... # Import math Library import math # Check whether the values are infinite or not print(math.isinf(56)) print(math.isinf(-45.34)) print(math.isinf(+45.34)) print(math.isinf(math.inf)) print(math.isinf(float("nan"))) print(math.isinf(float("inf"))) print(math.isinf(float("-inf"))) print(math.isinf(-math.inf)) Try it Yourself »
🌐
W3Schools
w3schools.com › jsref › jsref_infinity.asp
JavaScript Infinity Property
Infinity is a number that represents positive infinity. ... Coding fundamentals as bite-sized lessons and challenges. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com ...
🌐
Note.nkmk.me
note.nkmk.me › home › python
Infinity (inf) in Python | note.nkmk.me
August 11, 2023 - This article explains how to create, operate, check, and compare inf (infinity). ... In Python, the float type includes inf, which represents infinity.
🌐
Medium
medium.com › @ryan_forrester_ › infinity-in-python-complete-guide-ad7f108adf15
Infinity in Python: Complete Guide | by ryan | Medium
October 24, 2024 - inf = float('inf') ninf = float('-inf') # Basic comparisons print(inf > 999999999999999) # Output: True print(ninf < -999999999999999) # Output: True # Infinity with itself print(inf == inf) # Output: True print(inf > inf) # Output: False print(inf >= inf) # Output: True # Operations with infinity print(inf + 1 == inf) # Output: True print(inf - inf) # Output: nan print(inf * 0) # Output: nan
🌐
Medium
allwin-raju.medium.com › infinity-in-python-b1d8e03803aa
Infinity in Python. In Python, you can represent infinity… | by Allwin Raju | Medium
February 5, 2025 - Infinity in Python In Python, you can represent infinity using float('inf'). It can be used in mathematical operations, comparisons, and algorithms that require an infinitely large value. Read for …
🌐
Scaler
scaler.com › home › topics › how to represent infinity in python?
How to Represent Infinity in Python? - Scaler Topics
May 4, 2023 - We can use the float() function in Python to represent the positive infinity and negative infinity. For positive infinity, we need to pass 'inf' to the float() function and for negative infinity, we need to pass '-inf' to the float() function.
🌐
Python.org
discuss.python.org › ideas
Integer infinity - Ideas - Discussions on Python.org
December 11, 2023 - You could accomplish this by annotating retries: int | float and passing retries=float("inf") or retries=math.inf, but it would be nice if you could just pass int("inf") and not need to change the type annotation.
🌐
Python Central
pythoncentral.io › infinity-in-python-how-to-represent-and-use-infinite-numbers
Infinity In Python: How to Represent (And Use!) Infinite Numbers | Python Central
June 27, 2023 - In Python, infinity is termed an undefined ("indeterminate" is a better word) value that can be positive or negative. In this brief guide, we'll walk you through representing and using infinity in your Python programs.
🌐
Replit
replit.com › home › discover › how to write infinity in python
How to write infinity in Python | Replit
April 14, 2026 - Learn how to represent infinity in Python. Discover different methods, real-world applications, and tips for debugging common errors.