I found an error on Wikipedia. It can be found here. The formula reads: (pi / (2 * M(1, 4 / s))) - (m * ln(2)) where s = x / (2 ^ m); s > 2 ^ (p / 2); p is the desired bits of precision in the result; and M computes the arithmetic-geometric mean. The formula should be ((pi * (4 / s)) / (2 * M(1, 4 / s))) - (m * ln(2)). I confirmed this empircally, by testing the algorithms to see which one gave the correct result and posted the correction to wiki. After all, if I can confirm that information is incorrect, I don't want the error to stand on wiki. Some people might be relying on this. Unfortunately, it was futile. Someone deliberately restored the error. Perhaps I am overly worried. Anyone who wants to use the algorithm can do a sanity check on the results and see that it is wrong. But it is possible to overlook the fact that correcting the factor will make it work. And I know that I could never arrive at the algorithm from scratch.
Edit: It is perhaps fitting that my rendition had its own error. I was trying to maintain the general format of the formula as stated but thinking in different terms. As x increases without bound {[(pi / 2) * x] / AGM(1, x)} - ln(4 * x) --> 0. (AGM here stands for the arithmetic geometric mean.) My initial thought was in terms of a factor adjustment. However, in the original formula (not my correction) if "4 / s" is changed to "4 * s" it comes out correctly.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment