This content has been marked as final. Show 2 replies
Find an implementation of Java that supports extended exponents. That gives you exponents up to 16383 or so. Sable VM may be one of those.
First of all, any solution requires some amount of numerical analysis to understand the accuracy of any approximation you decide on. Now your particular complaint about 'd' becoming zero and the log going to -INFINITY doesn't make sense because you should be computing the sum of the exponentials first, then taking the log of the sum. If you did this you would not get -INFINITY you would get something around -1000.
If you're inner sum is finite and small, I would concentrate on an accurate approximation of that. You might consider purely algebraic manipulations such as computing a common denominator for the inner sum so that the problem is transformed into ln (numer / denom) = ln(numer) - ln(denom). This approach might just make things harder, I don't know. Eventually you might use a tool like the Taylor series approximation for ln (1+x) or ln(1-x) or e^x to simplify the expression. In any event, always analyze the error of your approximation. Again, this analysis may have you using the Taylor series so keep that handy.