Skip to content

Commit

Permalink
Improve histogram Print() output
Browse files Browse the repository at this point in the history
  • Loading branch information
fako1024 committed Jun 24, 2024
1 parent 5e4a89a commit 60f05b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions hist/h1.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ func (h *H1[T]) Print(w io.Writer) error {

tabw := tabwriter.NewWriter(w, 2, 2, 2, byte(' '), 0)

yfmt := func(y float64) string {
if y > 0 {
return strconv.Itoa(int(y))
}
return ""
}

fmt.Fprintf(w, "Mode: %v\n", h.Mode())

for i := 0; i < len(h.bins)-1; i++ {
Expand Down Expand Up @@ -241,3 +234,10 @@ func (h *H1[T]) Interpolate(x float64) float64 {

return y0 + (x-x0)*((y1-y0)/(x1-x0))
}

func yfmt(y float64) string {
if y > 0 {
return strconv.FormatFloat(y, 'f', 2, 64)
}
return ""
}

0 comments on commit 60f05b7

Please sign in to comment.