MCPcopy Create free account
hub / github.com/cli/cli / floatToString

Function floatToString

pkg/cmd/release/view/view.go:222–226  ·  view source on GitHub ↗

render float to fixed precision using truncation instead of rounding

(f float64, p uint8)

Source from the content-addressed store, hash-verified

220
221// render float to fixed precision using truncation instead of rounding
222func floatToString(f float64, p uint8) string {
223 fs := fmt.Sprintf("%#f%0*s", f, p, "")
224 idx := strings.IndexRune(fs, '.')
225 return fs[:idx+int(p)+1]
226}

Callers 1

humanFileSizeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected