The python numeric limitations, such as there are any, are available on the sys
module:
sys.float_info
is a named tuple with floating point limitations for your platform. Floating point numbers consist of a exponent and a precision; you'd have to be more precise about what you mean by the largest number here; the number with the largest exponent and the full precision in use is sys.float_info.max
.
sys.int_info
; not so much limitations as the implementation detail; you should be able to estimate the largest integer possible from this. Python integers are only limited by your available memory.
sys.maxsize
; the platform word size and limit to lists and tuples and the likes.
So for integers, there basically is a soft limit to the maximum and minimum values. It depends on how much memory your process can use, and how much memory your process is already using for other things.
In Python 3, there no longer is a separate long
type, but in Python 2, sys.maxsize + 1
would have to be a long
, as would -sys.maxsize - 2
. Between those two extremes lies the range of possible 'short' integers.
For complex numbers, ordering is a little more.... complex anyway. Complex numbers have a real and imaginary component, both are floats. Guess what? These are python floats and you already have their limit info above:
>>> type(1j)
<type 'complex'>
>>> type(1j.real)
<type 'float'>
>>> type(1j.imag)
<type 'float'>