MCPcopy Create free account
hub / github.com/github/gh-aw / formatVolumeChange

Function formatVolumeChange

pkg/cli/audit_math_helpers.go:22–31  ·  view source on GitHub ↗

formatVolumeChange formats the volume change as a human-readable string

(total1, total2 int)

Source from the content-addressed store, hash-verified

20
21// formatVolumeChange formats the volume change as a human-readable string
22func formatVolumeChange(total1, total2 int) string {
23 if total1 == 0 {
24 return "+∞"
25 }
26 pctChange := (float64(total2-total1) / float64(total1)) * 100
27 if pctChange >= 0 {
28 return "+" + formatPercent(pctChange)
29 }
30 return formatPercent(pctChange)
31}
32
33// formatPercentagePointChange formats the change between two ratio values (0.0-1.0) as a
34// percentage-point delta (e.g. "+1.5pp", "-2.3pp")

Callers 5

computeFirewallDiffFunction · 0.85
computeRunMetricsDiffFunction · 0.85
computeTokenUsageDiffFunction · 0.85
TestFormatVolumeChangeFunction · 0.85

Calls 1

formatPercentFunction · 0.85

Tested by 1

TestFormatVolumeChangeFunction · 0.68