import "math/big" func Root(a *big.Float, n uint64) *big.Float { limit := Exp(New(2), 256) n1 := n-1 n1f, rn := New(float64(n1)), Div(New(1.0), New(float64(n))) x, x0 := New(1.0), Zero() _ = x0 for { potx, t2 := Div(New(1.0), x), a for b:=n1; b>0; b>>=1 { if b&1 == 1 { t2 = Mul(t2, potx) } potx = Mul(potx, potx) } x0, x = x, Mul(rn, Add(Mul(n1f, x), t2) ) if Lesser(Mul(Abs(Sub(x, x0)), limit), x) { break } } return x } func Abs(a *big.Float) *big.Float { return Zero().Abs(a) } func Exp(a *big.Float, e uint64) *big.Float { result := Zero().Copy(a) for i:=uint64(0); i