Big Numbers

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
r.z.
Learning poster
Posts: 56
Joined: Thu Jun 05, 2003 1:57 pm

Big Numbers

Post 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......
Moni
Experienced poster
Posts: 202
Joined: Fri Mar 22, 2002 2:00 am
Location: Chittagong. CSE - CUET
Contact:

Post 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 ;) }.............)
ImageWe are all in a circular way, no advances, only moving and moving!
bugzpodder
Experienced poster
Posts: 147
Joined: Fri Jun 13, 2003 10:46 pm

Post 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!
r.z.
Learning poster
Posts: 56
Joined: Thu Jun 05, 2003 1:57 pm

Post 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:
SilverSprite
New poster
Posts: 5
Joined: Mon Jul 14, 2003 7:14 am
Location: Windsor Ontario

Re: Big Numbers

Post 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?
Few are those who see with their own eyes and feel with their own hearts.
bugzpodder
Experienced poster
Posts: 147
Joined: Fri Jun 13, 2003 10:46 pm

Post by bugzpodder »

um, just add like normally how you would add
Post Reply

Return to “Algorithms”