Calculate Nth root with integer arithmetic

前端 未结 6 928
梦如初夏
梦如初夏 2020-12-16 15:12

There are a couple of ways to find integer square roots using only integer arithmetic. For example this one. It makes for interesting reading and also a very interesting the

6条回答
  •  误落风尘
    2020-12-16 15:40

    It seems to me that the Shifting nth root algorithm provides exactly what you want:

    The shifting nth root algorithm is an algorithm for extracting the nth root of a positive real number which proceeds iteratively by shifting in n digits of the radicand, starting with the most significant, and produces one digit of the root on each iteration, in a manner similar to long division.

    There are worked examples on the linked wikipedia page.

提交回复
热议问题