The Big instance.
The root to calculate. Must be an integer. Defaults to 2.
The number of decimal places to keep in the result (optional). Defaults to 20.
Optional
mutable: boolean = falseWhether to mutate the first Big instance. Defaults to false.
The nth root of the Big instance with the specified precision and rounding mode.
const big1 = new Big(16);
console.log(sqrtBig(big1).toString()); // 4.00000000000000000000
console.log(sqrtBig(big1, 4, 0).toString()); // 2
console.log(sqrtBig(big1, 4, 1).toString()); // 2.0
console.log(sqrtBig(Big(0), 4).toString()); // 0
console.log(sqrtBig(Big(1), 4).toString()); // 1
console.log(sqrtBig(Big(-1), 4).toString()); // throws Error
console.log(sqrtBig(Big(16), 0.5).toString()); // throws Error
console.log(sqrtBig(Big(16), -2).toString()); // throws Error
console.log(sqrtBig(Big(16), 4, -1).toString()); // throws Error
Generated using TypeDoc
Calculates the nth root of a Big instance with custom precision and rounding mode.
Note: it's the most weighted function in the library. It's reusing a lot of other functions, and it's not perfect in performance, recommended to use it only when you need it and with default precision and rounding mode. It uses the Newton's method to calculate the root.