Python Forum

Full Version: int infinity
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i could use an int infinity. i need the number infinity to do some compares. of course, float infinity works fine with > and < comparing to an int. the problem i am having is that the code i'm feeding this to runs the numbers through int() (because it wants to accept floats). then the infinity i give it does not go through int(). if it were to just stay float infinity, or int supported an infinity special value, these could work. any suggestions?

i do not need an int nan.
I am a beginner too but I found Infinite integer in Python \- Stack Overflow; does that help? The last answer there says I added an implementation of extended integers on PyPI; I think you can install extended-int ยท PyPI for that.
unfortunately this is intended to be distributed to customers where installing a pypi package is not a option. everything has to be in python 3 itself or my code. i'm thinking of trying to create my own type where itself is the result of any arithmetic involving it except for inf-inf=0 and inf/inf=1. it would be my first type that involves operators. i have already worked around this. i wanted some cleaner code.

years before i started with python, i had design my own language that had some similarity to python and pike. the syntax was more like pike or C. it had an inf that was not int or float or complex. working it through arithmetic would usually get inf as a result. but it was its own type or a special type. type(inf)=inf. nan existed but was specific to the "machine float" that eventually became "ieee float". that's where nan made sense as it was meant to be floating point implementation specific. i never implemented this language.