Overload Operator to make unlimited size integer

C

cxcodexc

I am trying to overload the +, *, and - operators using variables of
type int but allowing them to hold unlimited size. Can anyone help me
do this?

thanks
 
D

David White

cxcodexc said:
I am trying to overload the +, *, and - operators using variables of
type int but allowing them to hold unlimited size. Can anyone help me
do this?

I don't understand. Say you have a 32-bit int. There are 2^32 different bit
patterns that it can be, so there are 2^32 different values that it can
have. You can map those patterns to any values you like, but you can't have
any more of them.

DW
 
E

Elie Nader

cxcodexc said:
I am trying to overload the +, *, and - operators using variables of
type int but allowing them to hold unlimited size. Can anyone help me
do this?

thanks
of type "int" that holds unlimited size?....uh?.....really?....in C++ !!! i
doubt about that...

NO SOLUTION..


Eliahooo
 
C

cxcodexc

So say i have two integer variables both holding 200,000 if i
mulptiply these and store the new value in another integer variable it
will not hold the result. As the result is too big. I want to extend
this integer variable type to hold any size. I heard i had to use and
array of integers and a pointer or something along those lines

Any ideas??
 
V

Victor Bazarov

cxcodexc said:
[...]
So say i have two integer variables both holding 200,000 if i
mulptiply these and store the new value in another integer variable it
will not hold the result. As the result is too big. I want to extend
this integer variable type to hold any size. I heard i had to use and
array of integers and a pointer or something along those lines

Any ideas??

Do you know how to use a search engine? Try www.google.com and
search for "arbitrary size integer implementation" (without the
quotes, of course).

Victor
 
G

Gianni Mariani

cxcodexc said:
So say i have two integer variables both holding 200,000 if i
mulptiply these and store the new value in another integer variable it
will not hold the result. As the result is too big. I want to extend
this integer variable type to hold any size. I heard i had to use and
array of integers and a pointer or something along those lines

Any ideas??

There are at least 3 C++ libraries I know of that will do what you want.
The most "advanced" I think is GMP. Did you try it out ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top