Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!ulysses!ggs From: ggs@ulysses.UUCP Newsgroups: comp.lang.c Subject: Re: math function speed Message-ID: <2096@ulysses.homer.nj.att.com> Date: Fri, 20-Feb-87 18:58:13 EST Article-I.D.: ulysses.2096 Posted: Fri Feb 20 18:58:13 1987 Date-Received: Sat, 21-Feb-87 10:48:27 EST References: <4943@mimsy.UUCP> <2550005@hpisod2.HP> <756@unc.unc.UUCP> <5640@brl-smoke.ARPA> Distribution: na Organization: AT&T Bell Laboratories, Murray Hill Lines: 51 In article <5640@brl-smoke.ARPA>, gwyn@brl-smoke.UUCP writes: > > In a test where the result of "sqrt" was compared to known correct > answers, for the following arguments: > > 0 1/5 1/3 1/2 1 2 e > 3 pi 4 5 9 10 16 > 49 100 10000 > > I got the following results: > > SVR2 function "sqrt": > > max abs error: 2.7755576e-17 > max rel error: 2.4037034e-17 > > 4.3BSD function "sqrt": > > max abs error: 5.5511151e-17 > max rel error: 3.3669215e-17 I thought the usual measure of accuracy was in units of "least significant bits". I repeated my test that compared a "best" solution with a library version, this time with the sqrt that I got from the BRL System V emulation package (sorry, I don't have a real VAX System V to try, and the 3B20 is a different beast). My result, using 100000 random positive doubles: SVR2 function "sqrt" one bit errors: 20356 two bit errors: 0 4.3BSD function "sqrt" one bit errors: 8634 two bit errors; 0 I question your choice of test numbers: any sqrt function that misses 0 is broken. Seven of the seventeen numbers are perfect squares, and six are powers of two. They are excellent boundary value tests, but statistically unusual. I would like to add a cheer to the group at Berkeley who re-worked the math library for 4.3BSD. It looks like a good start, and some people seem to have put a lot of thought into it. -- Griff Smith AT&T (Bell Laboratories), Murray Hill Phone: 1-201-582-7736 UUCP: {allegra|ihnp4}!ulysses!ggs Internet: ggs@ulysses.uucp