fixed the boundary condition and linted

This commit is contained in:
nikikalwar 2020-12-17 06:55:48 +05:30
parent 506aefbc78
commit 5ed34c7d05

View File

@ -13,12 +13,12 @@ export default function fastPowering(base, power) {
// Anything that is raised to the power of zero is 1.
return 1;
}
if (power < 0 ) {
if (power < 0) {
const powerNext = power * -1;
const baseNext = 1 / base;
// console.log("sssss")
return fastPowering(baseNext, powerNext);
// console.log("sssss")
return fastPowering(baseNext, powerNext);
}
if (power % 2 === 0) {