long integer multiplication

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

  1. helPlease

    helPlease Guest

    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
    suggestions then please tell.
     
    helPlease, Apr 30, 2007
    #1
    1. Advertising

  2. helPlease said:

    > 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
    > suggestions then please tell.


    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
    #2
    1. Advertising

  3. helPlease

    Chris Dollin Guest

    helPlease wrote:

    > 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
    #3
  4. Chris Dollin said:

    > helPlease wrote:
    >
    >> 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
    #4
  5. helPlease

    Chris Dollin Guest

    Richard Heathfield wrote:

    > Chris Dollin said:
    >
    >> helPlease wrote:
    >>
    >>> 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
    #5
  6. helPlease

    Chris Dollin Guest

    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
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan Pop
    Replies:
    0
    Views:
    1,212
    Dan Pop
    Jun 24, 2003
  2. cyberdude
    Replies:
    2
    Views:
    5,163
    Keith Thompson
    Jun 25, 2003
  3. helPlease

    long integer multiplication

    helPlease, Apr 29, 2007, in forum: C Programming
    Replies:
    8
    Views:
    453
    osmium
    Apr 29, 2007
  4. William Hughes
    Replies:
    13
    Views:
    1,285
    Ben Bacarisse
    Mar 15, 2010
  5. Suresh V
    Replies:
    5
    Views:
    3,857
    SaticCaster
    Jul 5, 2010
Loading...

Share This Page