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!bonnie!akgua!gatech!ut-sally!seismo!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.bugs.4bsd Subject: 4.?bsd "sort -n" says -0 == 0 (with documentation fix) Message-ID: <5309@elsie.UUCP> Date: Mon, 9-Dec-85 13:06:41 EST Article-I.D.: elsie.5309 Posted: Mon Dec 9 13:06:41 1985 Date-Received: Wed, 11-Dec-85 03:45:38 EST Organization: NIH-LEC, Bethesda, MD Lines: 55 Keywords: sort bsd Index: man/man1/sort.1 Fix Description: When sorting numbers, 'sort' takes "-0" to be equal to "0". Repeat-By: Run these commands through sh: awk 'BEGIN { for (f = -3.1; f <= 3.1; f += 0.5) printf "%3.0f\n", f; exit }' > a sort -n < a > b pr -m -t -l1 -w20 a b and note the output: -3 -3 -3 -3 -2 -2 -2 -2 -1 -1 -1 -1 -0 0 0 -0 1 1 1 1 2 2 2 2 3 3 where the lines with "-0" and "0" have been swapped because they were sorted alphabetically (since their numerical values were taken to be equal). Fix: Add the material between the ".NU" and the ".." directives below to "man/man1/sort.1" As usual, the trade-secret status of the material involved precludes a clearer posting. An initial numeric string, consisting of optional blanks, optional minus sign, and zero or more digits with optional decimal point, is sorted by arithmetic value. .NU (Note that .B \-0 is taken to be equal to .BR 0 .) .. Option .B n implies option .B b. -- 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