Skip to content

Commit

Permalink
fix: computation of median statistic with even number of values
Browse files Browse the repository at this point in the history
  • Loading branch information
wI2L committed Feb 17, 2022
1 parent 5398d1b commit 18a7886
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ func (t table) medianQuantities(column func(i int) *resource.Quantity) *resource
return nil
} else if l%2 == 0 {
q := values[l/2-1]
q.Add(*(values[l/2+1]))
q.Add(*(values[l/2]))
tmp := inf.Dec{}
tmp.QuoRound(q.AsDec(), inf.NewDec(2, 0), 0, inf.RoundDown)
tmp.QuoRound(q.AsDec(), inf.NewDec(2, 0), 3, inf.RoundDown)

return resource.NewDecimalQuantity(tmp, resource.DecimalSI)
}
Expand Down

0 comments on commit 18a7886

Please sign in to comment.