Chris Murphy Chris Murphy - 1 year ago 80
Java Question

sqrt, cbrt - what if don't want squared or cubed root, but any root?

In maths libraries in Java and Clojure you can usually find a power (or exponent) function. In

it is
. But I haven't been able to find a generic function for finding any root. In
you can get the squared root with
, and the cubed root with
. What if I want to find the 4th root? I am looking for an implementation or the formula.

Answer Source

Use Math.pow(a, 1/b) to compute the bth root of a.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download