Page 1 of 1

C++ question

Posted: Thu Mar 17, 2011 8:02 pm
by only_me
what variable should i use if i want to memorize a big number? like a 30 digits one

unsigned long only memorize 10 digits..

later edit: meh i don't think such thing exist >_>
:(

Re: C++ question

Posted: Thu Mar 17, 2011 8:53 pm
by [SD]Twysta
use long long. that's 19 digits.

paste me ur code i'll help you

Re: C++ question

Posted: Thu Mar 17, 2011 9:02 pm
by NuclearSilo
oh come on, someone doesn't know how to google
it's in the 1st page http://msdn.microsoft.com/en-us/library ... tz(v=vs.80).aspx

Re: C++ question

Posted: Thu Mar 17, 2011 9:04 pm
by only_me
i need to do %666013 ( this is a prime number ) from a very big number.
that very big number i get it with this formula:
S=S*(v[i]+1)+S;

the vector has like 1'000'000 numbers .. so the number will be quite big.

i think i ll need to find a better method rather than doing all the calculus..


and for nuclearsilo, those are for microsoft visual c++.
it doesn't work for borland c++.. i mean that _int64 won't work :(

Re: C++ question

Posted: Thu Mar 17, 2011 11:34 pm
by Stress
There are many big integer libraries out there. Notably, I have used BigInt and GMP. The code in BigInt and GMP is designed to be cross-platform, so you shouldn't have problems deploying it in your programming environment.

EDIT:
Borland C++ sucks. Why would anyone still use that?

Re: C++ question

Posted: Thu Mar 17, 2011 11:58 pm
by SM-Count
Just do all the calculations in mod (very big number). You will never exceed 6 digits.

Re: C++ question

Posted: Fri Mar 18, 2011 12:02 am
by iGod
Stress wrote:There are many big integer libraries out there. Notably, I have used BigInt and GMP. The code in BigInt and GMP is designed to be cross-platform, so you shouldn't have problems deploying it in your programming environment.

EDIT:
Borland C++ sucks. Why would anyone still use that?


We used to learn c++ on that in school, DOS mindset. :l

edit: shit, forgot to answer op... just off the top of my head, did you try "extended", or was that just for floating point operations? (I barely had a C in computer sciences class lol)

Re: C++ question

Posted: Thu Mar 24, 2011 3:40 pm
by apan
I've only used Python =/