Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site elsie.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!pyramid!ut-sally!seismo!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.bugs.4bsd Subject: bug in 4.?bsd libnm version of sqrt (with fix) Message-ID: <6003@elsie.UUCP> Date: Thu, 2-Jan-86 20:29:58 EST Article-I.D.: elsie.6003 Posted: Thu Jan 2 20:29:58 1986 Date-Received: Sat, 4-Jan-86 05:34:04 EST Organization: NIH-LEC, Bethesda, MD Lines: 47 Keywords: libnm sqrt Index: libnm/sqrt.s Fix Description: The 4.?bsd "libnm" version of "sqrt" handles negative arguments differently than the way documented in the exp(3m) manual page. Repeat-By: Feeding these lines to your favorite shell: cat > try.c << EOF main() { extern double sqrt(); extern int errno; double d; d = sqrt(-4.); printf("%d\n", errno); printf("%g\n", d); } EOF cc try.c -lnm a.out and noting the output: 98 -2 which differs from the documented: 33 0 Fix: As usual, the trade secret status of the code involved precludes a clearer posting. The change comes near the end of "libnm/sqrt.s": negarg: # Next few lines added by ado, January 1986 .set EDOM,33 movl $EDOM,_errno clrd r0 ret # Last few lines added by ado, January 1986 Note also that the lines that originally followed the "negarg:" label may be removed. -- Bugs is a Warner Brothers trademark. -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX and Elsie are Digital Equipment and Borden trademarks