This commit is contained in:
Jaw0r3k 2024-07-15 16:34:37 +02:00 committed by GitHub
commit a2eb60538f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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;