Sign in to follow this  
nuclear123

32bit int largest num!

Recommended Posts

4 294 967 296 <-- around here should be the largest value able to be stored in a 32 bit int value. What would happen to my program if i stored 5 000 000 000 and then tried to view the value? will it convert my number to exponential form to be able to store it?

Share this post


Link to post
Share on other sites
What happens depends on what language you're using. Python will happily change the type from a regular int to a long int. C++ will generally store the value mod two to the thirty-second.

Share this post


Link to post
Share on other sites
Quote:
Original post by nuclear123
4 294 967 296 <-- around here should be the largest value able to be stored in a 32 bit int value. What would happen to my program if i stored 5 000 000 000 and then tried to view the value? will it convert my number to exponential form to be able to store it?
You can only store that large of a value if your int is unsigned. Otherwise what SiCrane said.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this