Does anybody know how to use integers larger than the "long long int" type? I have tried using arrays of ints, but mathematical functions are impossible.

Thanks in advance. :cheesy:

Recommended Answers

All 10 Replies

You'll need a bignum library. I've seen mention of the Gnu Multiple Precision library before, so you might give that a shot.

Thanks, that's exactly what I need.

Just out of curiosity, does anybody know how it works? (i.e. how it stores the numbers and how it performs math functions on them)

Thanks! :cheesy:

Oh, and also, how do you use it in windows?

Member Avatar for iamthwee

I tried using that for windows once, and in the end just gave up! Ended up using java's bigNum class.

Going back to my original question, is there a way to create my own bigNum class, and use it like an int?

> Just out of curiosity, does anybody know how it works?
Read the documentation and download the code.

> is there a way to create my own bigNum class, and use it like an int?
I assume they taught you basic math at school, like how to add multi-digit numbers together, how to subtract them, how to multiply them etc.

It's the same thing, except you deal with multiple bytes.

Yes, but how would you use the bigNum class in-place of an int? For example, if you wanted to use the pow() function...

bigNum i;
pow(i,3);

wouldn't work.

Member Avatar for iamthwee

Of course it wouldn't work, you have to create your own pow function/method for your big integer class you have created.

Ok, your right. Well, I had better get started!

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.