How can anyone give you a valid answer if we don't know what is in your variables? What is in num?
My guess is this is a dynamic range problem. Your numbers seem to have a huge range, but double precision arithmetic is pretty limited in that respect. So I would STRONGLY recommend that you look at the computations from the standpoint of 16 digit computations. It may be that a careful scaling of the units in this problem will suffice. Of course, you could always go the symbolic route, and look for solutions that way.
By the way, you should recognize that 10d15 is equivalent to 1d16. Or do you think that you were trying to start at 10^15? You have written the number 10^16, not 15.
