Thread: how to deal wth large numbers

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    3

    how to deal wth large numbers

    Hi,
    As a part of an assignment ... I need to deal with large numbers ( 512 bit to 1024 bit ). A number of mathematical operations too are needed to be performed on them like XOR, finding the prime among them and multiplying the primes so found etc.

    now how do I store these numbers - the dattypes ???
    and how do I do these manipulations

    probably the conventional methods fail here ????

    Thanks in advance for the suggestions.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    The quick answer is to use a library, eg. http://gmplib.org/
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    Some code to look at:
    http://www.codeproject.com/cpp/largenumber.asp

    That was the first thing I found after a quick search on google.com. You could probably find articles with great deal on the matter, just use google to search for them.

    Salem:
    Poseidon - God of the C

    lol... nice
    Last edited by simpleid; 06-18-2007 at 06:20 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing unique numbers to an array
    By yardy in forum C Programming
    Replies: 6
    Last Post: 12-27-2006, 09:15 PM
  2. Representing a Large Integer with an Array
    By random_accident in forum C Programming
    Replies: 3
    Last Post: 03-03-2005, 08:56 PM
  3. Representing a Large Integer with an Array
    By random_accident in forum C++ Programming
    Replies: 3
    Last Post: 03-03-2005, 12:23 PM
  4. Large Numbers
    By Hypercase in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2004, 06:56 PM
  5. How to deal with repeating rational numbers
    By carrja99 in forum C++ Programming
    Replies: 2
    Last Post: 10-21-2002, 11:33 AM