Skip to content

Commit 18a7886

Browse files
committed
fix: computation of median statistic with even number of values
1 parent 5398d1b commit 18a7886

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cli/table.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ func (t table) medianQuantities(column func(i int) *resource.Quantity) *resource
277277
return nil
278278
} else if l%2 == 0 {
279279
q := values[l/2-1]
280-
q.Add(*(values[l/2+1]))
280+
q.Add(*(values[l/2]))
281281
tmp := inf.Dec{}
282-
tmp.QuoRound(q.AsDec(), inf.NewDec(2, 0), 0, inf.RoundDown)
282+
tmp.QuoRound(q.AsDec(), inf.NewDec(2, 0), 3, inf.RoundDown)
283283

284284
return resource.NewDecimalQuantity(tmp, resource.DecimalSI)
285285
}

0 commit comments

Comments
 (0)