LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-01-2011, 05:59 PM   #1
mongrel666
LQ Newbie
 
Registered: Apr 2011
Location: Australia
Distribution: Slackware 13.1 and Ubuntu
Posts: 4

Rep: Reputation: 0
Question Max int size now available?


Hi, nice Noob with Noob question.
I am doing prime number research and I need to know what the max int size is? Does gcc support any other number declarations that would be better than just plain old int (this is in C BTW) that allow for integer handling??

Thanks in advance,

Jason.
 
Old 05-01-2011, 09:02 PM   #2
plpl303a
Member
 
Registered: May 2011
Posts: 52

Rep: Reputation: 3
Unsigned ints (uint32_t) are up to 2**32 - 1 (a little over 4 billion).
A long long (or uint64_t) is up to 2**64 - 1 (~18 quintillion)

If you want arbitrary precision arithmetic, check out gmp (http://gmplib.org/)
 
Old 05-02-2011, 01:43 AM   #3
mongrel666
LQ Newbie
 
Registered: Apr 2011
Location: Australia
Distribution: Slackware 13.1 and Ubuntu
Posts: 4

Original Poster
Rep: Reputation: 0
Awesome!
I have this crappy little athalon Semperon laptop which is my dedicated Prime Number calculator and it just crapped its pants when it saw "quintillion"...
 
Old 05-02-2011, 02:36 AM   #4
winning
Member
 
Registered: Apr 2011
Posts: 70

Rep: Reputation: 13
The maximum int value is INT_MAX as defined by limits.h
 
1 members found this post helpful.
Old 05-02-2011, 10:06 PM   #5
plpl303a
Member
 
Registered: May 2011
Posts: 52

Rep: Reputation: 3
Quote:
Originally Posted by winning View Post
The maximum int value is INT_MAX as defined by limits.h
Yes, indeed; that will be the limit for signed ints. UINT_MAX will give you the maximum size for unsigned integers; LLONG_MAX for signed long longs (64 bits) and ULLONG_MAX for unsigned long longs.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
signed/unsigned int and vector::size() [KIA]aze Programming 1 11-23-2007 06:19 PM
max harddrive size Berhanie Linux - Hardware 4 05-19-2007 05:51 PM
Max cluster size Pauli Slackware 0 03-20-2005 04:41 PM
max process size textomat Linux - General 1 11-06-2004 01:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration