eta oin shrdlu wrote:I'm not sure exactly what your algorithm is, but it's possible to do better than these examples (though not as well as the spectacular sqrt(163) result): e.g.,
exp(47247985 - 68164432 * log(2)) ~= 3.14159265[416505]
and
exp(-3203012462534 + 4620970195605*log(2)) ~= 3.141592653589[68227]
These have error roughly 1/|n|, which is about as close as we should expect to get.
(To get these, I started by finding the CFE convergents to log(2) with their errors, then subtracted these errors from the initial fit error of log(pi) at m=n=0 to get successively better approximations.)
Nice work, eta oin shrdlu!
I was intentionally vague with my algorithm description, in the hope that someone would come up with a more accurate one.

My algorithm is very basic: it totally ignores errors in the CFE convergents.
Let x = e
m2
nlog x = m + n * log 2
Let x ~= u / v, using standard continued fraction techniques
u = v * m + v * log 2 * n
Let v * log 2 ~= p / q, once again using continued fractions
u * q = (v * q) * m + p * n
Now use the extended Euclidean algorithm to find a, b:
(v * q) * a + p * b = 1
(v * q) * a * u * q + p * b * u * q = u * q
(v * q) * (a * u * q + k * p) + p * (b * u * q - k * v * q) = u * q, for any k
Let k be the closest integer to -a * u * q / p or to b * u / v
Then m = a * u * q + k * p and n = b * u * q - k * v * q
FWIW, I was pondering how to deal with those continued fraction errors earlier today... I was also considering investigating what happens when you generate upper and lower bounding expressions and take their geometric mean.