[net.bugs.4bsd] 4.?bsd "sort -n" says -0 == 0

ado@elsie.UUCP (Arthur David Olson) (12/09/85)

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