Jump to content
  • Advertisement
Sign in to follow this  
indigox3

numeric limits in python?

This topic is 4748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
I don't think there exist such constants, no (of course, they could be hiding somewhere...)

Python ints are guaranteed to be 32 bits. When they overflow, they are automatically converted to longs, which are not limited in size (except by how much memory you have).

int_min would be -(2**31) and int_max would be 2**31-1

Share this post


Link to post
Share on other sites
Are they guaranteed to be 32 bits? Last time I checked for the C Python distribution they were implemented using longs so they are at least 32 bits, but may be greater, depending on the compiler used to build the Python interpreter.

Share this post


Link to post
Share on other sites
Ok, I was hoping to use those values to initialize some data like:

def findMin( list ):
min = some_const_for_max

for s in list:
if s < min:
min = s

...

but that doesn't really make sense if there is no limits on integer numbers.

def findMin( list ):
min = list[0]

...
works just the same...


Thanks for the info

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!