Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site turtlevax.UUCP Path: utzoo!linus!decvax!decwrl!turtlevax!ken From: ken@turtlevax.UUCP (Ken Turkowski) Newsgroups: net.math Subject: Re: need fast algorithm for reciprocal Message-ID: <423@turtlevax.UUCP> Date: Wed, 20-Jun-84 14:36:15 EDT Article-I.D.: turtleva.423 Posted: Wed Jun 20 14:36:15 1984 Date-Received: Thu, 21-Jun-84 11:06:23 EDT References: <480@burl.UUCP> Organization: CADLINC, Palo Alto, CA Lines: 24 Suppose we want to calculate: C = A / B. This can be equivalently calculated as: C = A * (1/B) Consider the equation: F(X) = (1/X) - B The solution of: F(X) = 0 is the reciprocal of B. Use Newton's method to find the root: X[i+1] = Xi - F(Xi)/F'(Xi) = Xi - (1/Xi - B) / -Xi^2 = Xi(2 - B * Xi) One can find the initial iterate, X0, from table lookup. Convergence is quadratic: i.e. the precision doubles with every iteration. For example, suppose the table lookup has 8 bits of accuracy; the first iteration will produce 16 bits of accuracy, the second will produce 32. The result will converge as long as the initial iterate, X0, is in the range: 0 < X0 < 2/B, B > 0 2/B < X0 < 0, B < 0 -- Ken Turkowski @ CADLINC, Palo Alto, CA UUCP: {amd70,decwrl,flairvax}!turtlevax!ken