Skip to content

Commit

Permalink
uses natural log instead of log10
Browse files Browse the repository at this point in the history
  • Loading branch information
petethepig committed Jul 24, 2019
1 parent d96f756 commit 257ebb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions httprender.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (h *httpServer) renderer(w http.ResponseWriter, r *http.Request) {
}

if logScale {
maxYVal = float32(math.Log10(float64(maxYVal)))
maxYVal = float32(math.Log(float64(maxYVal)))
}

bucketXSize := uint32(to.Sub(from)/time.Second) / uint32(maxDataPoints)
Expand All @@ -107,7 +107,7 @@ func (h *httpServer) renderer(w http.ResponseWriter, r *http.Request) {
for _, d := range allData {
dv := d.value
if logScale {
dv = float32(math.Log10(float64(dv)))
dv = float32(math.Log(float64(dv)))
}
bucketIndex := int(dv / bucketYSize)
if bucketIndex < bucketCount {
Expand All @@ -127,7 +127,7 @@ func (h *httpServer) renderer(w http.ResponseWriter, r *http.Request) {
}
bucketLowerBoundary := float32(i) * bucketYSize
if logScale {
bucketLowerBoundary = float32(math.Pow(float64(bucketLowerBoundary), 10.0))
bucketLowerBoundary = float32(math.Exp(float64(bucketLowerBoundary)))
}
resultArray = append(resultArray, &renderReturn{
Target: fmt.Sprintf("%f", bucketLowerBoundary),
Expand Down

0 comments on commit 257ebb0

Please sign in to comment.