Page 1 of 1

Big Numbers

Posted: Sat Jul 12, 2003 2:31 pm
by r.z.
do you know the algorithm how to store a big number in an array of char
and then calculate it?

I know how to do it for addition and substraction but for multiplication I still can't find the right way.....

the number can be floating type

like : 1234.52

please help me with my problem here......

Posted: Sat Jul 12, 2003 6:42 pm
by Moni
I know this is not the right way! But you can try.............

Use your addtion routine to make multiplication!

3 * 2 means:

3 + 3 or 2 + 2 + 2 isn't it?

Then ..............

(Actually you should use the process that we follow when doing multiplications in the paper with just a pen { not calculator ;) }.............)

Posted: Sat Jul 12, 2003 7:14 pm
by bugzpodder
you can either look up some source code, or write your own! :D anywayz an eazy way to implement it is to figure out where the decimal places are, take them out, multiply them like integers and put them back in!

Posted: Sun Jul 13, 2003 4:29 am
by r.z.
ok thanks a lot :)

then I can use a string then seperate it into a struct which has int decimal, int integer,int sign.

thanks for your help :)

I have to make a program that can calculate 5000 digits number :lol:

Re: Big Numbers

Posted: Mon Jul 14, 2003 7:29 am
by SilverSprite
r.z. wrote:I know how to do it for addition and substraction but for multiplication I still can't find the right way.....
can you share the theory behind your way of doing it for addition and subtraction?

Posted: Tue Jul 15, 2003 12:13 am
by bugzpodder
um, just add like normally how you would add