200 digit number!!!!! READ

Discussion in 'C' started by Qxx1, Aug 16, 2010.

  1. Qxx1

    Qxx1 New Member

    Joined:
    Aug 16, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    how to perform addition substraction on a 200 digit number in 'C'?????
    how to read that big number??
    i have to do it in float.
    someone spoke of 'big float', wat is that??
     
  2. micsom_micsom

    micsom_micsom New Member

    Joined:
    Mar 23, 2009
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Embedded C Programmer
    Location:
    India,Hybd
    Try using a Linked List , the Node can have the Digit, the carryover,....

    Its a simple program.
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    You can't do it with the built-in types; you will have to implement your own. One way is to represent the numbers with strings, e.g.
    Code:
    char *pi="3.1415926535897932384626450288";
    
    which will retain its accuracy as long as you want it to (i.e. there is no conversion to binary).

    Adding/subtracting numbers will be just an implementation of how you did this back in school. Remember doing sums like this one?
    12345
    2008+
    =====

    5+8 is 13, carry 1 and write 3. 4+0+1 is 5. And so on.
     
    shabbir likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice