diff --git a/floats.go b/floats.go index b5d29d5e..ec69f1c2 100644 --- a/floats.go +++ b/floats.go @@ -236,7 +236,7 @@ func Min(s []float64) (min float64, ind int) { // nearest to v. If several such indices exist, the lowest index // is returned // TODO: Add test -func Nearest(s []float64, v float64) (ind int) { +func Nearest(v float64, s []float64) (ind int) { dist := math.Abs(v - s[0]) ind = 0 for i, val := range s { diff --git a/floats_test.go b/floats_test.go index 62c4e6e9..1433c91f 100644 --- a/floats_test.go +++ b/floats_test.go @@ -284,7 +284,7 @@ func TestMin(t *testing.T) { func TestNearest(t *testing.T) { //s := []float64{3, 5, 6.2, 6.2, 8} - //ind + //ind := Nearest(s, ) } func TestNorm(t *testing.T) {