guido@mcvax.UUCP (Guido van Rossum) (01/05/84)
One of my colleagues discovered that the log function the the mathematical C library is quite inaccurate. What's more, he also provided a change to one of the coefficients which much improved it. Here they are: BAD: p2 = -.963769093368686593e1; GOOD: p2 = -.963769093377840513e1; ^^^^^^^^ So now you should all go and fix your C library. I found the same coefficients in UNIX V7 as in 4.2 BSD, so I suspect they are probably in almost all other UNIXes around the world. Related question: the source states "The coefficients are #2705 from Hart & Cheney. (19.38D)". We cannot locate this reference in our institute's library. Does someone know what this references, and give us a more precise pointer? Guido van Rossum, {philabs,decvax}!mcvax!guido Centre for Mathematics and Computer Science, (CWI, formerly MC), Amsterdam (with thanks to Lambert Meertens)
geoff@utcsstat.UUCP (Geoffrey Collyer) (01/08/84)
DDT BAD: p2 = -.963769093368686593e1; GOOD: p2 = -.963769093377840513e1; ^^^^^^^^ Related question: the source states "The coefficients are #2705 from Hart & Cheney. (19.38D)". We cannot locate this reference in our institute's library. Does someone know what this references, and give us a more precise pointer? Guido van Rossum, {philabs,decvax}!mcvax!guido Centre for Mathematics and Computer Science, (CWI, formerly MC), Amsterdam --- The oft-cited Hart & Cheney is Computer Approximations John F. Hart, E. W. Cheney, Charles L. Lawson, Hans J. Maehly, Charles K. Mesztenyi, John R. Rice, Henry G. Thacher, Jr., Christoph Witzgall Robert E. Kreiger Publishing Company, 645 New York Avenue, Huntington, New York 11743, 1978 Copyright 1968 by John Wiley & Sons, Inc. Original edition 1968 Reprint 1978 with corrections Library of Congress: QA297.C64 1978 ISBN 0-88275-642-7 This book appears to have been used as a source of coefficients throughout the mathematical library (-lm). The ``BAD'' p2 coefficient above is from table 2705 on p. 195. p. 111 explains that this table is coefficients for computing ln(x) as approximately z*(zP(z^2)/Q(z^2)), z=(x-1)/(x+1) where x is on the range [1/sqrt(2), sqrt(2)] and yields a precision of 19.38, where precision is defined as ``the range of validity of the approximation (-log10(maximum error))'' (p. 83). I'm *certainly* no numerical analyst, but I read that to mean that precision is the number of significant digits that may be assumed to be correct. Geoff Collyer, U. of Toronto