根据这些文档 %g是%e for large exponents, %f otherwise. 但是,当我这样做时:package mainimport "fmt"func main() { var a float64 = 2.0 fmt.Printf("%f\n", a) fmt.Printf("%e\n", a) fmt.Printf("%g\n", a)}我得到:2.0000002.000000e+002为什么输出%g不包含固定的小数位,如%e或%f?
- 1 回答
- 0 关注
- 279 浏览
添加回答
举报
0/150
提交
取消