[erlang-questions] Integer nth-root (Re: [erlang-questions] Integer square root)

Hynek Vychodil <>
Tue Feb 2 18:48:54 CET 2010


Numeric mathematic is not as simple as seems at first sight. Rounding
errors can lead to numeric instability. Try bignum_root:root(3,2) for
example.

There is little bit improved version:
http://gist.github.com/292750

On Tue, Jan 26, 2010 at 6:44 AM, Kenji Rikitake <> wrote:
> http://gist.github.com/286576
> for the GitHub users.
>
> Kenji Rikitake
>
>> %% This is a quick hack of code for Integer nth-root in Erlang.
>>
>> %% Power function (X ^ Y) and root function (X ^ (1/Y)) for
>> %% integers in Erlang
>> %% by Kenji Rikitake <> 26-JAN-2010
>> %% Distributed under MIT license at the end of the source code.
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>



-- 
--Hynek (Pichi) Vychodil

Analyze your data in minutes. Share your insights instantly. Thrill
your boss.  Be a data hero!
Try GoodData now for free: www.gooddata.com


More information about the erlang-questions mailing list