render float to fixed precision using truncation instead of rounding
(f float64, p uint8)
| 220 | |
| 221 | // render float to fixed precision using truncation instead of rounding |
| 222 | func 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 | } |