RosettaCodeData/Task/Nth-root/Sidef/nth-root-2.sidef

7 lines
203 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
func nthroot_fast(n, a, precision=1e-5) {
2018-06-22 20:57:24 +00:00
{ a = nthroot(2, a, precision) } * int(n-1)
a ** (2**int(n-1) / n)
2016-12-05 23:44:36 +01:00
}
2018-06-22 20:57:24 +00:00
say nthroot_fast(5, 34, 1e-64) # => 2.02439745849988504251081724554193741911462170107