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!harvard!seismo!brl-tgr!tgr!milne@icse.uci.edu From: milne@icse.uci.edu (Alastair Milne) Newsgroups: net.micro Subject: Arctan approximation for generating pi Message-ID: <1086@brl-tgr.ARPA> Date: Fri, 27-Dec-85 22:16:56 EST Article-I.D.: brl-tgr.1086 Posted: Fri Dec 27 22:16:56 1985 Date-Received: Sat, 28-Dec-85 13:25:26 EST Sender: news@brl-tgr.ARPA Lines: 37 I must agreee with the observations about the speed of the power series suggested so far. Two key points in my understanding of numeric approximation: 1. For numeric approximations which people are actually going to have to use in their work, avoid power series if possible. Deadly slow, even if, as some will, they converge sufficiently within 5 terms or fewer. 2. Don't raise values to exponents unless it's unavoidable. The implementations used in most languages use EXP and LN, which are themselves approximations, resulting in representation error, round-off error, and amplification of these in the multiplications which produce the final result. Wirth knew what he was doing when he refused to put exponentiation into Pascal. The best way I know of to get around both of these is to use continued fractions. And most fortunately, there is a very nice continued fraction form for arctan which requires perhaps 3 floating point divisions, and 2 floating-point additions. Furthermore, it gives a very pleasant number of significant digits. Incredibly few operations for a very good result. Naturally, I am describing it like this because I can't at the moment recall its exact form (sorry!). It is among some of my old numeric analysis notes. When (and if) I find it, I'll send it in. I think the people who need this will be quite impressed with it. I certainly was when it was first shown to me, by a teacher who made sure we first endured coding power series evaluations. Alastair Milne PS. Like Sheldon Meth, I am very intrigued by the apparently special relationship between atan(1/5) and atan(1/239). But is it really true than pi, a transcendental number, is EQUAL to a linear combination of these two, or does it only lie within an acceptable tolerance?