Thread: huge-number-application

  1. #1
    Unregistered
    Guest

    Unhappy huge-number-application

    I´m a 15-year old interestet pupil and I´ve a big problem:

    I wanna write c-applications which need huge numbers and
    I think that there must exist some libraries which are easy to program. I use the gcc-compiler under Linux.

    You can mail me at "[email protected]".



    Thank you!

  2. #2
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125
    How big are the numbers you wants to use?

    For example the maximum value a unsigned long integer can store is 4,294,967,295. You can specify it to be bigger ( for example as unsigned long long int ) and then you will a bigger range of values that is able to handle (I am not sure of the exact number, but it would go into trillions).

    As far as liibraries are concerned, I am pretty sure there are some math libraries available, so I would recommend running a search on google to look for some.

    Cheers.
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659

    GMP is what you want

    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.

  4. #4
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    well, there are two choices:

    1. making an array of char's, and each char is a digit. and making your own functions for adding, substracting and everything else

    Pros: very easy to understand and implement
    easier to work with
    easier to debug

    Cons: a very interesting Memory waste

    2. making an array of int's and summing the bits to have greater values (eg. an array of 1000 int's would make you a 32*1000=32000 bit variable)

    Pros: Very fast, and cost-effective

    Cons: VERY tough to implement

    Oskilian

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. scanf oddities
    By robwhit in forum C Programming
    Replies: 5
    Last Post: 09-22-2007, 01:03 AM
  2. Learning Memory, Ins and Outs?
    By Zoiked in forum C Programming
    Replies: 1
    Last Post: 08-27-2007, 04:43 PM
  3. Prime number program problem
    By Guti14 in forum C Programming
    Replies: 11
    Last Post: 08-06-2004, 04:25 AM
  4. help with a source code..
    By venom424 in forum C++ Programming
    Replies: 8
    Last Post: 05-21-2004, 12:42 PM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM