]> Cypherpunks repositories - gostls13.git/commit
sort: fixed bug in (Float64Slice) Less; NaN less than anything else
authorFlorian Uekermann <florian@uekermann-online.de>
Sat, 23 Jul 2011 19:47:06 +0000 (15:47 -0400)
committerRuss Cox <rsc@golang.org>
Sat, 23 Jul 2011 19:47:06 +0000 (15:47 -0400)
commit480ef72c230f4f42447865716fc9f502ca032795
treec791e012277829c06cc91926d021333522b60b31
parent47410a2490f4d16f44d4724e34588a2a0de0e8f1
sort: fixed bug in (Float64Slice) Less; NaN less than anything else

Previously comparisons with NaN led to contradictory results if it was
compared to anything not NaN, since Less always returned false, thus
breaking monotonicity of ordering.
This fix makes NaN less than anything else and adds NaN and (+-)Inf to
testcases.

Fixes #2092.

R=golang-dev, r, rsc, r
CC=golang-dev
https://golang.org/cl/4805051
src/pkg/sort/sort.go
src/pkg/sort/sort_test.go