# long integer multiplication

Discussion in 'C Programming' started by helPlease, Apr 30, 2007.

By long integer i mean very large number(say of 20 digits).If i store
it in a character array then what mechanism shud i follow to multiply
two such numbers.Could Booth's algo. be applied.Or if anybody has any

2. ### Richard HeathfieldGuest

> By long integer i mean very large number(say of 20 digits).If i store
> it in a character array then what mechanism shud i follow to multiply
> two such numbers.Could Booth's algo. be applied.Or if anybody has any

See "The Art of Computer Programming", Volume 2 ("Seminumerical
Algorithms"), by Donald E Knuth, section 4.3.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.

Richard Heathfield, Apr 30, 2007

3. ### Chris DollinGuest

> By long integer i mean very large number(say of 20 digits).

20 decimal digits doesn't express a "very large" number; it's not even
enough for the number of protons in the observable universe.

--
"If there is a problem, you must confess it, Mr Chaplin"/The Beiderbeck Affair/

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

Chris Dollin, Apr 30, 2007
4. ### Richard HeathfieldGuest

Chris Dollin said:

>
>> By long integer i mean very large number(say of 20 digits).

>
> 20 decimal digits doesn't express a "very large" number; it's not even
> enough for the number of protons in the observable universe.

Yes, it is. You only need four. According to Schneier (not a fabulous
reference, I know, but convenient), there are 2 to the 265 atoms in the
galaxy. Assuming no more than 128 protons per atom on average (surely a
reasonable assumption!), that makes 2 to the 272 protons. Four digits
all told.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.

Richard Heathfield, Apr 30, 2007
5. ### Chris DollinGuest

Richard Heathfield wrote:

> Chris Dollin said:
>
>>
>>> By long integer i mean very large number(say of 20 digits).

>>
>> 20 decimal digits doesn't express a "very large" number; it's not even
>> enough for the number of protons in the observable universe.

>
> Yes, it is. You only need four.

I believe the OPs request has implicitly framed the digits as being
composed in the traditional fashion, in which four digits will get
you more more than 9999.

But then, you knew that, you rascal.

--
"Go not to the Elves for counsel, for they will answer both no and yes."/tLotR/

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN

Chris Dollin, Apr 30, 2007
6. ### Chris DollinGuest

Chris Dollin wrote:

> I believe the OPs request has implicitly framed the digits as being
> composed in the traditional fashion, in which four digits will get
> you more more than 9999.

(fx:growl)

s/more more/no more/.

--
"It took a very long time, much longer than the most /Sector General/
generous estimates." - James White

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN

Chris Dollin, Apr 30, 2007