icz*_*cza 6

100.55100.55100.55
100.55100.551/30.333333333....
float64float64

现在当你"说"这个:

x := 100.55
xxfloat64IEEE-754100.55100.55
x := 100.55
fmt.Printf("%.50f\n", x)

100.54999999999999715782905695959925651550292968750000
100.55
100float64(int(x))100.0
x = x - float64(int(x))
fmt.Printf("%.50f\n", x)

0.54999999999999715782905695959925651550292968750000
0.550.55float64
fmt.Printf()%f
fmt.Printf("%.2f\n", x)

结果:

0.55
100
cents := 10055
fmt.Printf("%d.%d $", cents/100, cents%100)

输出:

100.55 $