You are right that an integer infinity is possible, and that none has been added to the Python standard. This is probably because math.inf supplants it in almost all cases (as Martijn stated in his comment).

In the meantime, I added an implementation of extended integers on PyPI:

In [0]: from numbers import Integral, Real

In [0]: from extended_int import int_inf, ExtendedIntegral, Infinite

In [0]: i = int_inf

In [4]: float(i)
Out[4]: inf

In [5]: print(i)
inf

In [6]: i ** i

Out[6]: inf

In [7]: i
Out[7]: inf

In [9]: isinstance(i, Real)

Out[9]: True

In [10]: isinstance(i, Integral)

Out[10]: False

In [11]: isinstance(i, Infinite)

Out[11]: True

In [12]: isinstance(i, ExtendedIntegral)

Out[12]: True

In [13]: isinstance(2, ExtendedIntegral)

Out[13]: True

In [14]: isinstance(2, Infinite)

Out[14]: False
Answer from Neil G on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-infinity
Python infinity (inf) - GeeksforGeeks
Pythons math.inf constant return positive infinity and -math.inf returns negative infinity.
Published ย  July 12, 2025
Discussions

How stupid is the idea of having infinity included in integer type? More over, how to design a integer/floating point system that makes more sense mathematically?
As a mathematician: Infinity is not an integer. The nice thing when you don't have infinity as a term is that you can define numbers inductively, and you lose that when including infinity. On the other hand, you could implement general ordinal numbers, that could be fun. But I would have an extra type, I think. To floats: You could have arbitrary precision floats/big decimals, or rationals. Or even symbolic execution, but that is probably a bit too much, you're building a CAS at that point. More on reddit.com
๐ŸŒ r/ProgrammingLanguages
65
26
July 26, 2023
How to represent an infinite number in Python? - Stack Overflow
Copyfrom decimal import Decimal ... negative_infinity = Decimal('-Infinity') ... Upvoted for the sys.maxsize since we often want integers . I wish they had named it maxint instead so it would be easier to remember 2024-08-28T20:18:20.55Z+00:00 ... Save this answer. ... Show activity on this post. In python2.x there was ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Represent infinity as an integer in Python 2.7 - Stack Overflow
As of Python 3.5, you can write infinity as math.inf (having put import math in your imports), and negative infinity as -math.inf. More on stackoverflow.com
๐ŸŒ stackoverflow.com
float('inf') is bad practice
math.inf is there for you, and I prefer it over float('inf') in most if not all cases. More on reddit.com
๐ŸŒ r/Python
72
79
April 15, 2024
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Infinity (inf) in Python | note.nkmk.me
August 11, 2023 - Negative infinity can be represented by adding - to inf. f_inf_minus = -float('inf') print(f_inf_minus) # -inf print(type(f_inf_minus)) # <class 'float'> ... While a float value can typically be converted to int using int(), inf is an exception ...
๐ŸŒ
Flexiple
flexiple.com โ€บ python โ€บ python-infinity
Python Infinity - All you need to know | Flexiple Tutorials - Flexiple
March 14, 2022 - According to this standard, a ... 0. Additionally, if the sign bit is 0, it is positive infinity, while a 1 in the sign bit denotes a negative infinity....
๐ŸŒ
FavTutor
favtutor.com โ€บ blogs โ€บ infinity-python
Infinity in Python: How to Represent with Inf? (with Examples)
April 3, 2023 - For a wide range of uses, Python includes built-in support for infinity, both positive and negative. float('inf') indicates positive infinity, whereas float('-inf') indicates negative infinity.
๐ŸŒ
CodeGym
codegym.cc โ€บ java blog โ€บ learning python โ€บ infinity in python: mastering the infinite
Infinity in Python: Mastering the Infinite
August 13, 2024 - This is more of a workaround than a direct method, but it can be quite effective when you need an integer representation of infinity. If youโ€™re not a fan of using float('inf'), Python gives you a few other options. For instance, you can use the decimal module to represent infinity with greater precision: from decimal import Decimal positive_infinity_decimal = Decimal('Infinity') negative_infinity_decimal = Decimal('-Infinity') print(positive_infinity_decimal) # Output: Infinity print(negative_infinity_decimal) # Output: -Infinity
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_math_inf.asp
Python math.inf Constant
For negative infinity, use -math.inf. The inf constant is equivalent to float('inf'). ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com ยท If you want to report ...
๐ŸŒ
Reddit
reddit.com โ€บ r/programminglanguages โ€บ how stupid is the idea of having infinity included in integer type? more over, how to design a integer/floating point system that makes more sense mathematically?
r/ProgrammingLanguages on Reddit: How stupid is the idea of having infinity included in integer type? More over, how to design a integer/floating point system that makes more sense mathematically?
July 26, 2023 -

So in my imagined language, efficiency is not an issue. I decide to use arbitrary precision integers(i.e. big ints). I realize that sometimes you need infinity as a boundary, so I'm curious, how bad is the idea of having positive/negative infinity in integer type?

I know the fact that you have more UBs, like 0*inf doesn't make sense, but it's fundamentally the same as div by 0 problems. And it should be solved the same as div by 0s.

And for floating numbers, we're all plagued by precision problems, so I think it should make sense for any floating number to be encoded by x = (a, b), where it means that: a - b < x < a + b, and as you do floating point arithemetic, b grows and you lose the precision.

In general, is there any efforts on designing a number system for both integer/floating nums that make more sense mathematically, when you don't care about performance?

EDIT: just realized that haskell have both NAN and INF included in the language.

๐ŸŒ
STechies
stechies.com โ€บ python-infinity
Infinity in Python - Represent an Infinite Number in Python
Therefore in python, we cannot represent infinity, or we can say that there is no way to show the infinity as an integer. But we can use float (inf) as an integer. In Python, positive infinity and negative infinity can be represented by:
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-can-i-represent-an-infinite-number-in-python
How can I represent an infinite number in Python?
November 9, 2022 - As a result, we cannot represent ... integer. However, float (inf) can be used as an integer. ... Because infinity can be both positive and negative, it can be expressed as a float('inf') and a float('-inf') respective...
๐ŸŒ
It Interview Guide
itinterviewguide.com โ€บ python-negative-infinity
How to Work with Python negative Infinity and Test Them โ€“ It Interview Guide
March 17, 2026 - Though most basic math functions in a Python object will not deal with infinite or negative infinite results, when you do work with infinity and negative infinity, you can still get NaN results.
๐ŸŒ
iO Flood
ioflood.com โ€บ blog โ€บ python-infinity
Python Infinity: Syntax, Uses, and Examples
February 12, 2024 - Python, like many programming ... You can create positive and negative infinity in Python using float('inf') and float('-inf'), respectively....
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ python infinity
Python Infinity โ€“ Be on the Right Side of Change
September 16, 2020 - Summary: Python Infinity is an undefined value (negative or positive) such that positive infinity is greater than while negative infinity is lesser than any other value in a given code.
๐ŸŒ
Medium
sanatinia.medium.com โ€บ how-to-work-with-infinity-in-python-337fb3987f06
How to Work with Infinity in Python | by Amirali Sanatinia | Medium
May 27, 2020 - Meaning every natural number (positive ... negative integers (โ€ฆ, -2, -1, 0, 1, 2, โ€ฆ) are bigger than negative infinity (-โˆž) and smaller than positive infinity. Want to read this story later?
๐ŸŒ
DEV Community
dev.to โ€บ ashutoshvaidya โ€บ infinity-in-python-12m3
Infinity In Python - DEV Community
January 21, 2023 - Python's Math module is well-known and widely utilized for any mathematical operation we want to do. It also allows for infinity. For reference, below is a code excerpt. import math # Defining a positive infinite integer positive_infinity = math.inf print('Positive Infinity: ', positive_infinity) # Defining a negative infinite integer negative_infinity = -math.inf print('Negative Infinity: ', negative_infinity) # Expected Output: # Positive Infinity: inf # Negative Infinity: -inf
๐ŸŒ
DEV Community
dev.to โ€บ hrishikesh1990 โ€บ how-to-represent-an-infinite-number-in-python-2fm2
How to represent an infinite number in Python? - DEV Community
April 18, 2022 - For Negative Infinity Value: Addition value: -inf Subtraction value: -inf Multiplication value: -inf Division value: -inf ยท Infinite is the concept of something that is unlimited, endless, without bound. As a result, Hermann Weyl wrote a book, "Levels of Infinity" in which he says, "Mathematics is the science of the infinite" and can be read online. Python has other great concepts, and one can read about them here.
๐ŸŒ
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 - You can use the attributes math.inf and -math.inf to denote positive and negative infinity, respectively. However, you can only use the math module to represent infinity if you're using Python 3.5 or above.