func stripTrailingZeros(s string) string { … } func stripTrailingDigits(s string, digits int) string { … } // Ftoa converts a float to a string with no trailing zeros. func Ftoa(num float64) string { … } // FtoaWithDigits converts a float to a string but limits the resulting string // to the given number of decimal places, and no trailing zeros. func FtoaWithDigits(num float64, digits int) string { … }