blob: f1175dd1a2b4470c26634e961a5a6bf178c9ada2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
package plot
import "strconv"
const maxDigits = 7
// Ff formats a float
func Ff(x float64) []rune {
minExact := strconv.FormatFloat(x, 'g', -1, 64)
fixed := strconv.FormatFloat(x, 'g', maxDigits, 64)
if len(minExact) < len(fixed) {
return []rune(minExact)
}
return []rune(fixed)
}
|