thehobbit said:
thanks... i am sure that they represent valid numbers.. but not able
to use atoll function on my system (called HP3000)... gives a run time
error. any particular library needs to be included when using the
atoll function?
Ian was working on the incorrect assumption that you have access to a C99
compiler. It is odd that he should assume this, since practically nobody
has access to a C99 compiler.
The problem you are having is that the numbers you wish to add are too big
to fit into any of the integer types you appear to have available on your
system, and too big to fit *exactly* into any of the floating point types.
It's at times like this that you need to reach for your friendly
neighbourhood "bignum" library, such as GMP (Gnu Maths Package, I think)
or Miracl. These libraries provide the functionality you need. (If you
don't like that answer, you could do what I did, which is to write your
own bignum library - and, if all you want to do is add two (or more) big
numbers together, it's pretty easy to do that yourself. Just think about
how you stop overflow. In fact, just think about how you don't even
*consider* overflow when adding numbers with pencil and paper. It's never
an issue, is it? Why not? Because you have more paper on the left, that's
why, and you allocate enough for your needs, which you can more or less
work out in your head (for any two numbers neither of which is more than D
digits long, D + 1 digits will suffice to store the answer, sometimes with
room to spare).