mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-13 06:23:00 +08:00
fixed:error
This commit is contained in:
parent
a64c587080
commit
3b1fcd8333
@ -14,13 +14,6 @@ export default function fastPowering(base, power) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(power<0){
|
|
||||||
power=power*-1;
|
|
||||||
base=1/base;
|
|
||||||
// console.log(base);
|
|
||||||
fastPowering(base,power);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (power % 2 === 0) {
|
if (power % 2 === 0) {
|
||||||
// If the power is even...
|
// If the power is even...
|
||||||
// we may recursively redefine the result via twice smaller powers:
|
// we may recursively redefine the result via twice smaller powers:
|
||||||
|
Loading…
Reference in New Issue
Block a user