我无法在 Go 中使用 BigInt.Div() 时获取值。
大整数:
totalAllocPoint, _ := instance_polypup.TotalAllocPoint(&bind.CallOpts{}) //*big.int
fmt.Println("totalAllocPoint: ", totalAllocPoint)// 54000
poolInfoStruct, _ := instance_polypup.PoolInfo(&bind.CallOpts{}, &pid) //*big.int
fmt.Println("allocPoint: ", poolInfoStruct.AllocPoint)// 2000
我试图使用以下代码进行划分,始终返回0:
poolInfoStruct.AllocPoint.Div(poolInfoStruct.AllocPoint, totalAllocPoint)
fmt.Println("poolAlloc: ", poolInfoStruct.AllocPoint)
poolAlloc := big.NewInt(0).Div(poolInfoStruct.AllocPoint, totalAllocPoint)
fmt.Println("poolAlloc: ", poolAlloc)
poolAlloc := big.NewInt(0)
poolAlloc.Div(poolInfoStruct.AllocPoint, totalAllocPoint)
fmt.Println("poolAlloc: ", poolAlloc)
守候你守候我
相关分类