According to these docs %g
is %e for large exponents, %f otherwise
. However, when I do:
package main
import "fmt"
func main() {
var a float64 = 2.0
fmt.Printf("%f
", a)
fmt.Printf("%e
", a)
fmt.Printf("%g
", a)
}
I get:
2.000000
2.000000e+00
2
Why does the output for %g
not contain fixed decimal places like %e
or %f
?