root - nodef/extra-math GitHub Wiki

Find the nth root of a number (ⁿ√).

function root(x, n)
// x: a number
// n: root
const xmath = require('extra-math');


xmath.root(25, 2);
// → 5

xmath.root(-8, 3);
// → -2

References