Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/types/querybuildertypes/querybuildertypesv5/resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ func roundToNonZeroDecimals(val float64, n int) float64 {
// Round to n decimal places
multiplier := math.Pow(10, float64(n))
rounded := math.Round(val*multiplier) / multiplier
if math.IsInf(rounded, 0) {
// val*multiplier overflowed for near-max float64 values; the
// finite input must stay finite or the JSON encoder rejects it.
return val
}

// If the result is a whole number, return it as such
if rounded == math.Trunc(rounded) {
Expand Down
Loading