The smallest and largest values of numeric types
cam.ac.uk at mh391.invalid
Tue Apr 17 20:41:52 CEST 2007
> On Apr 17, 7:12 am, t... at finland.com wrote:
>> How can I determine the smallest and largest values
>> of numeric types (for example int) possible in my
>> system? I think there exists a function for this task
>> but I don't know it.
> This should work for ints:
> import sys
> print sys.maxint
One should note that ints bigger than sys.maxint are possible almost
seamlessly since Python will use longs for these numbers:
Python 2.5 (r25:51908, Mar 13 2007, 08:13:14)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
Of course performance decreases for longer longs.
More information about the Python-list