这里会用到一个依赖库:github.com/shopspring/decimal
package main
import (
"fmt"
"github.com/shopspring/decimal"
)
func main() {
aa := 25
bb := 84
proportion := float64(aa) / float64(bb)
floatVal, _ := decimal.NewFromFloat(proportion * 100).RoundFloor(2).Float64()
fmt.Println(floatVal) //29.76
}