Re: [go-nuts] Find n-th root of a big number

2020-09-22 Thread roger peppe
Relevant issue: https://golang.org/issue/14102 On Tue, 22 Sep 2020 at 08:54, Nasir Hussain wrote: > The Amazing Rob Pike :D > > On Tue, Sep 22, 2020 at 12:13 PM Rob Pike wrote: > >> I'm not going to debug you program for you - you'll learn more doing it >> yourself, but I glanced at it and saw

Re: [go-nuts] Find n-th root of a big number

2020-09-22 Thread Nasir Hussain
The Amazing Rob Pike :D On Tue, Sep 22, 2020 at 12:13 PM Rob Pike wrote: > I'm not going to debug you program for you - you'll learn more doing it > yourself, but I glanced at it and saw immediately that you're missing an > easy optimization. Raising a number to an integer power can be done much

Re: [go-nuts] Find n-th root of a big number

2020-09-22 Thread Rob Pike
I'm not going to debug you program for you - you'll learn more doing it yourself, but I glanced at it and saw immediately that you're missing an easy optimization. Raising a number to an integer power can be done much faster by repeated squaring according to the bit pattern of the exponent. I'll le

[go-nuts] Find n-th root of a big number

2020-09-21 Thread Hau Phan
i can't find get n-th root in document of go big package so i decided to do it myself using newton's method. i found a solution at https://www.geeksforgeeks.org/n-th-root-number/ and start to implement in go. but my code only work fine for base 2. other base result gone too far from correct. A