[Cfp-interest] avoiding the continued fraction problem
David Hough CFP
pcfp at oakapple.net
Thu May 29 15:11:25 PDT 2014
Perhaps this whole example can be avoided by avoiding
zero divisors:
d = x + f;
q = b[j] / d;
f = a[j] + q;
d1 = 1.0 + f1;
f1 = -(d1 / d) * q;
might become
d = x + f;
if (d == 0) d = eps * x ;
q = b[j] / d;
f = a[j] + q;
d1 = 1.0 + f1;
f1 = -(d1 / d) * q;
where eps is the roundoff level. Of course the explicit test can be
avoided by presubstitution, but this particular test and conditional move
might be pretty cheap. This amounts to using a slightly different x
for one iteration. I haven't figured out all the possible ramifications
in the original problem of such a choice.
There's always a way to program around some particular problem on some
particular platform. The question is what's a sufficiently
efficient way to get to a sufficiently efficient correct solution.
More information about the Cfp-interest
mailing list