Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!gabriel@anl-mcs From: gabriel@anl-mcs (John Gabriel) Newsgroups: net.sources Subject: Re: Solving Pi Message-ID: <600@brl-tgr.ARPA> Date: Sat, 10-Aug-85 17:12:21 EDT Article-I.D.: brl-tgr.600 Posted: Sat Aug 10 17:12:21 1985 Date-Received: Mon, 12-Aug-85 22:36:00 EDT Sender: news@brl-tgr.ARPA Lines: 43 I am entering this conversation not having seen previous correspondence, but here is a trick from my high school days (in England during WWII). arctan(x+h) = arctan(x) + arctan(h/(1 + h*x + x**2)) Therefore arctan(1) = arctan(1/2) + arctan(1/3) = arctan(1/4) + arctan(2/9) + arctan(1/6) + arctan(3/19) and so on etc. If we stop at the above 4 way split, the error after N terms is roughly 1 bit in 2*N. Thus for a 64 bit floating point number with a 56 bit fractional part we need only 28 terms. A further split reduces the problem to 8 series with the worst being a power series in 1/8. Algebraic ingeneuity can combine terms so that your may not be doing quite as much work as summing all the series. After 8 terms you lose as much as you gain from further splits. Better solutions for use in subroutine libraries exist and are given in "A Software Manual for the Elementary Functions" by W.J. Cody and W.M. Waite, Prentice Hall. However if you want to compute Pi to a few thousand decimal places other considerations arise like Do you want to use rational fraction arithmetic?, should you be using methods like continued fraction expansions?, and on and on. I seem to recollect results sort of like pi/10 = arctan(r) where r was some reasonable rational fraction, but I can't for the life of me remember how it was obtained. There are of course the results from the fact that a polygon with 2**n + 1 sides can be solved using nothing worse than square roots, and so once you have that solution you also have a rapidly convergent series, e.g. for arctan(2*pi/17). But you still must compute the square roots. On the whole methods using repeated fractions are probably best. For details about that, get in touch with Henry Thacher c/o Dept. of Computer Science, U. of Kentucky, Lexington KY. by snail mail or telephone. Henry has retired and lives somewhere in CA now, but the Dept should still know where to find him. John Gabriel