Thread: how to store a largest numbers?

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    28

    how to store a largest numbers?

    hi

    i have a problem.

    i want to store the largest numbers which is beyound the limit of all primitive data types.

    how can i store it?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Use a library - The GNU MP Bignum Library
    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
    Jan 2009
    Posts
    28
    i dont want to use the library.

    i want to do it not from library.

    i had listen that it can be possible through Xor operator or through string or may be from modulus operator.

    if any other way you know then kindly help me.
    thanks
    Last edited by maifs; 08-08-2009 at 03:27 AM.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Like
    char thisIsAlargeNumber[] = "12334567879809644532341346578669";

    Now write your own class which wraps around this idea, and overloads +,-,*,/
    Job's as good as done.
    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.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    28
    hi agian
    sory may be i didnt make you understand.

    actually its in the form like this.

    2 power of long limit.

    now have to save it .

  6. #6
    Registered User CrissyCrisCris's Avatar
    Join Date
    Aug 2009
    Posts
    13
    Store it as

    Code:
    double dNumberSqrt;
    dNumberSqrt = sqrt(12334567879809644532341346578669);
    and when you need to display it

    Code:
    std::cout << dNumberSqrt * dNumberSqrt
    Is that what you mean? Your English is kind of choppy.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Finding the 3 largest numbers of the five entered
    By Bkgrant in forum C Programming
    Replies: 11
    Last Post: 02-13-2009, 01:08 PM
  2. Find largest and second largest number (help)
    By Arkon in forum C++ Programming
    Replies: 6
    Last Post: 01-20-2006, 11:21 PM
  3. Do most people store numbers in char?
    By Elite in forum C Programming
    Replies: 2
    Last Post: 10-04-2003, 05:04 AM
  4. how should i store these?
    By Waldo2k2 in forum C++ Programming
    Replies: 8
    Last Post: 07-10-2002, 02:10 PM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 06:38 PM