A Division Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aditya sriram
    New Member
    • Oct 2007
    • 2

    #1

    A Division Problem

    hello, i have been trying to work on a division algorithm for numbers which have digits greater than 8. The solution i came up with was using character arrays and succesive subtraction but unfortunately its not efficient enough. Can anyone please help me find a more elegant solution?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    You can't use a double? That has 15 significant figures. Or a long double? That has about 30 significant fugures.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by aditya sriram
      hello, i have been trying to work on a division algorithm for numbers which have digits greater than 8. The solution i came up with was using character arrays and succesive subtraction but unfortunately its not efficient enough. Can anyone please help me find a more elegant solution?
      I think I don't understand your question; do you mean numbers such as 9999 ... 99?
      (all digits greater than 8)?

      kind regards,

      Jos

      Comment

      • aditya sriram
        New Member
        • Oct 2007
        • 2

        #4
        oh, sorry about the misconception, i meant that the program should be able to take numbers having more than 9 digits, and doubles and long doubles also have their limits, we are trying to work on an alogorithm for numbers which contain upto 100 digits. for eg. 123456789876543 21/5

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by aditya sriram
          oh, sorry about the misconception, i meant that the program should be able to take numbers having more than 9 digits, and doubles and long doubles also have their limits, we are trying to work on an alogorithm for numbers which contain upto 100 digits. for eg. 123456789876543 21/5
          Ah, ok, I understand now; sorry for being thick. Google for "big integer C"; there
          are a lot of free big integeger arithmetic packages out there. There's no need to
          write your own (unless that's what your assignment/homework told you to do).

          kind regards,

          Jos

          Comment

          Working...