fix: unnecessary steps

This commit is contained in:
Jaw0r3k 2023-07-30 22:08:20 +02:00 committed by Jaw0r3k
parent 76617fa83a
commit 14e3f46229
No known key found for this signature in database
GPG Key ID: 0D5F4388330F29B1

View File

@ -9,6 +9,11 @@
* @return {number} * @return {number}
*/ */
export default function fastPowering(base, power) { export default function fastPowering(base, power) {
if (power === 1) {
// Any number raised to the power of one is always that number
return base;
}
if (power === 0) { if (power === 0) {
// Anything that is raised to the power of zero is 1. // Anything that is raised to the power of zero is 1.
return 1; return 1;