使用big.ParseFloat获取a big.Float,然后使用Int方法将其转换为abig.Int:
flt, _, err := big.ParseFloat(input, 10, 0, big.ToNearestEven)\nif err != nil {\n /* handle a parsing error here */\n}\nvar i = new(big.Int)\ni, acc := flt.Int(i)\nRun Code Online (Sandbox Code Playgroud)\n\n\n\n通过将prec参数调整为ParseFloat,您可以控制中间浮点 \xe2\x80\x94 的精度,示例输入至少需要 72 位精度才能准确输出(以十个零结尾的值),但如果您使用默认值,则可以使用默认值pass 0 是 64 位。