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

@ -14,11 +14,11 @@ export default function fastPowering(base, power) {
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) {