mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 07:43:04 +08:00
fixed the boundary condition and linted
This commit is contained in:
parent
506aefbc78
commit
5ed34c7d05
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user