4/29/2013 4:58 PM
TheGuyWhoDisliked wrote: This uses the math features of C#. This does not do it recursively. Those are the reasons I disliked this. Reply to this
5/1/2013 8:57 AMRod Stephens wrote:
The intent here was to just do the job, not to show how to calculate the number yourself. If you do want to do it yourself, you can use Newton's method as shown in this example:
Or you can use subdivision. Pick an upper and lower bound, perhaps lower = 1 and upper = N / 2. Then check the value in the middle M. If MN > N, set lower = M and repeat. If MN < N, set upper = M and repeat.
Either way it still doesn't need to be recursive, though. Reply to this
This uses the math features of C#. This does not do it recursively. Those are the reasons I disliked this.
Reply to this
The intent here was to just do the job, not to show how to calculate the number yourself. If you do want to do it yourself, you can use Newton's method as shown in this example:
Reply to this